News for hackers. Stuff that matters.
Re:Benchmarking JS by vardump on Wednesday May 13, 2015 @10:28AM (#9539143)
C++ performance is a true minefield between different compilers and their versions. For example, fail to provide correct incantation of compiler flags or do something in code that confuses auto-vectorization, and your performance can suffer by an order of magnitude.

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?

There are no comments on this comment yet.