tag:blogger.com,1999:blog-10770855.post5588608401352295865..comments2024-03-28T03:20:57.393-04:00Comments on The Little Calculist: Quiz questionDave Hermanhttp://www.blogger.com/profile/00405190527081772997noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-10770855.post-966684425694142302009-01-30T17:03:00.000-05:002009-01-30T17:03:00.000-05:00Adding the first line of code in that exact form w...Adding the first line of code in that exact form will do nothing if optimization is enabled (it will be removed by dead code elimination).<BR/><BR/>The asm instruction will change instruction scheduling, register allocation and code layout, affecting the instruction cache, branch predictor and the out-of-order superscalar execution engine of your modern CPU (register renamer, reorder buffer etc.).<BR/><BR/>On microbenchmarks such small changes can create eg. 3x performance differences (by my own experiments)Slow Bytehttps://www.blogger.com/profile/17460918778532923786noreply@blogger.comtag:blogger.com,1999:blog-10770855.post-40822273719074624642009-01-30T13:53:00.000-05:002009-01-30T13:53:00.000-05:00A co-worker says "pipeline stall".A co-worker says "pipeline stall".Andrey Fedorovhttps://www.blogger.com/profile/12330915643975408997noreply@blogger.comtag:blogger.com,1999:blog-10770855.post-3832788400070223762009-01-30T10:33:00.000-05:002009-01-30T10:33:00.000-05:00I vaguely recall reading something about the mozil...I vaguely recall reading something about the mozilla people making JS opcode implementations different sized so that the branch predictor had more meat to chew on. Maybe something to do with that? On the other hand, if I've already read about it then presumably it wouldn't have been a mystery.<BR/><BR/>Some kind of alignment thing? I can't think of how code would be affected by that, though.Mitchhttps://www.blogger.com/profile/10045959297000131704noreply@blogger.com