2 ms·
Obviously, a faster way would be to place your functions at predictable addresses that could be computer with simple bit arithmetic. No double lookup or conditi
by alain94040 9y ago
Obviously, a faster way would be to place your functions at predictable addresses that could be computer with simple bit arithmetic. No double lookup or conditional branches required.
- firethief 9y agoComputed goto is also not always fastest. Someone benched it (I think it was in the context of interpreter main loops); any of the 3 approaches can win depending on arch and usage patterns.
- GuB-42 9y agoI'm not sure. It would create holes in the code, and it tends not to be a good thing for the cache. I also don't know how branch prediction will react with that. I suppose it should be tried and tested.
- majewsky 9y agoHow would that be possible in position-independent code (which you need for ASLR and such)? You'd need to fetch some base address from memory, even if you can compute the offset from that.