10 int or 20 with 2 off is very close as far as whether you should gem for it. To gem 40 int, losing a 10 int bonus, you basically trade 10 int for 20 haste/spirit (depending if socket is yellow/blue). Both haste and mastery are worth ~.47 int depending on your other stats, so in theory it is better to still gem 40 int, however a lot of people prefer to just get the bonus in that situation since it is so close and it looks better, while also having haste can have extra unnoted benefits when you have to move a lot and such. If the bonus is 20 of a secondary, it is basically the same option, except you trade 20 int for 40 haste/spirit/mastery, so again its personal preference. 10 of any secondary or 20 crit should always be ignored in favor of pure int gems though, and 20+ int should always be gemmed for as you dont lose anything :P,