I can only find the videos from 2014.
I can only find the videos from 2014.
This talk is a combination of two separate talks I have given before plus two new examples, based on my recent endeavors.
Talks merged here are LXJS 2013 one[1] where I talk about microbenchmarking pitfalls and WebRebels 2014 one[2] where describe how bugs in VMs can affect benchmarking results.
If you have any questions about the slides just ask them here or send me an email --- I will try to answer as soon as I can.
[1] https://www.youtube.com/watch?v=65-RbBwZQdU
[2] https://webrebels.23video.com/crooked-mirrors-of-performance...
Thanks again!
edit: to clarify. In C++ I write dumb but readable code knowing that the compiler will always perform specific optimizations. In JS it seems that there are many factors resulting in different optimization levels. How do I ensure that the VM does not execute my 'dumb but readable' code literally? Without that guarantee it seems that I have to frequently resort to optimized yet unreadable code.
For a single test case where V8 goes off the rails there are millions of lines of code across the globe which V8 optimizes correctly.
On a funny note: I actually do have a version of this talk where I show GCC going slightly of the rails and producing a code that is 3 times slower than it should be because it hits an (infamous) partial register dependency stall --- see StackOverflow question[1] for the gory details.
> How do I ensure that the VM does not execute my 'dumb but readable' code literally?
Well, as I do say in the talk: reasonable code should be reasonably fast. If it is not the case --- file bugs with VM vendors.
Keeping your code relatively static / monomorphic is the best way to achive performance in any language.
In any case I think it's much much much more important to optimize algorithms not their concrete implementations.
[1] http://stackoverflow.com/questions/26585977/64-bit-code-gene...
I guess a lot of Javascript micro-optimization comes down to don't change field type and give type hints in assignments. Like:
var integerType = 0|0;
integerType = 45|0;
integerType = (integerType + 1)|0;
That '|0' tells the Javascript VM that you have integer as real data type. If you'd suddenly assign 'integerType = 5.1;' or 'integerType = "string";', the built in guards would make the JIT compiled native code to fail and the Javascript engine would fall back to interpreting.Emscripten can be used to compile C++ into Javascript. Perhaps it could help you?
Sign up to their newsletter at http://gotocon.com/chicago-2015/