3 ms·
Allocating executable pages and running a compiler is orders of magnitude slower than just precomputing the multiplication factor.
by 10000truths 5y ago
Allocating executable pages and running a compiler is orders of magnitude slower than just precomputing the multiplication factor.
- anfilt 5y agoNot the op your responding too, but If this bit of of code is gonna run many billions of time it could very well be worth that cost.
- foota 5y agoIn a lot of cases you're working with code where you're storing divisors as a part of a data structure, so a JIT isn't really going to help with that.
- olliej 5y agoThere are plenty of times when you’re processing data where you load what is a runtime constant value but not a compile time constant. I mean the extreme case is obviously a scripting language , where lowering to multiplication may well be possible. That said you are correct in a JIT being vastly more heavyweight than most cases would need - but mostly due to the cost of making an indirect call rather than the cost of the jit itself