4 ms·
And if your platform is a virtual machine or interpreter running across a number of chip archs? Perhaps it would be better to simply have appropriate tests and
by DrScientist 7y ago
And if your platform is a virtual machine or interpreter running across a number of chip archs?
Perhaps it would be better to simply have appropriate tests and benchmarks to see what's slow on what platform?
Otherwise it's guess work based on incomplete understanding of the many layers below.
- ip26 7y agoGenerically cache and branch predict friendly code is worth most of the benefit. Micro-tuning is small potatoes compared to accidentally wiping the cache on each instruction (e.g. with badly designed objects) or mispredicting a thousand times in a row (e.g. with a poorly designed loop)
- ThrowawayR2 7y ago> "And if your platform is a virtual machine or interpreter running across a number of chip archs?" Outside of microcontrollers, I can't think of a processor in common use that doesn't have branch prediction or caches.
- DrScientist 7y agoTrue though I suspect that that the length of the pipeline and the cost of a cache miss will be quite different between ARM versus Intel. While, I'm a big fan not not writing poorly performing code, as you get death by a 1000 cuts. Is it not better to test rather than educated guess? ie The reason there is alot of poor performing code, is not a lack of understanding at a low level about caches and branch prediction, but a lack of care about performance?
- naikrovek 7y agoEven then, you're not going to be running on a wildly different set of architectures, I'm betting; it will be a finite set, of course, so you can attend to all the common optimizations and give the virtual machine what it needs to optimize the best it can. No one is going to write a single piece of code that runs on both a z80 and a 56-core Xeon, for example.