Re:Mispredicted branches can multiply your running times
by ip26 on Wednesday October 16, 2019 @09:07AM
(#21269909)
Generically 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)
Re:Mispredicted branches can multiply your running times
by naikrovek on Wednesday October 16, 2019 @07:28PM
(#21277222)
Even 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.
Re:Mispredicted branches can multiply your running times
by ThrowawayR2 on Wednesday October 16, 2019 @02:17PM
(#21273564)
> "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.
Re:Mispredicted branches can multiply your running times
by DrScientist on Friday October 18, 2019 @08:29AM
(#21290776)
True 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?
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.