what’s different between wpdb->prefix and table_prefix

The difference is pretty simple.

$wpdb->prefix is getting the prefix field from global $wpdb object.

$table_prefix can be anything. Most probably it’s some local variable that contains the same value, but you can assign anything to that variable.

So using $wpdb->prefix is a better idea – it’s nicer, cleaner and more obvious.