product targeting HTML5 games called Sphinx[0]. During it's development,
we (sadly) notice that rendering isn't the performance bottleneck, JS is
(specifically, [[GET]] and [[PUT]]s of methods on the base class)! We
hacked the JS engine a bit and developed some of dirty tricks[1] to
boost the performance that work in some JS engines and not others.
For V8, some optimiziation it uses like
* in-object slack tracking
* turning an object to dictionary mode when it has many properties
* the magic number 4 for turning polymorphic inline cache to
megamorhpic inline cache.
seem to be on the reverse direction of what games need in the "memory
vs. performance" tradeoff. Is that a problem we should try to solve?
The talk would be not be very structured because we don't have specific
goals in mind (and also that I don't have much expereince with JS
engines). Some possible outcomes include:
1) Launching an effort in the Games CG to make a benchmark specifically
targeting JS performance.
Some of the games benchmark out their do thousands times of Canvas calls
but these are not the bottleneck in hardware-accelearated Canvas
implementation.
2) Lauching a CG as a forum for JS game developers and JS engine
engineers to discuss whether some of the JS patterns used in games are
JITed to close-to-native code in open source JS engines.
We can also document some important heuristics used in JS engines (say,
the dictionary mode/fast mode heurisics[2]) that would be useful in
developing those dirty tricks (which are probably as bad as those
'transform 3d' tricks for WebKit, but let's discuss it).
3) Perhaps a <meta> tag that selects the right JS engine profile for games.
People say that global switches are bad[3]. Does that apply to
performance-only switches?
[0] http://sphinx.oupeng.com/en/
[1]
http://dev.oupeng.com/wp-content/uploads/20131109-kennyluck-optimizing-js-games.html
[2]
https://github.com/oupengsoftware/v8/wiki/Dictionary%20Mode%20%28English%29
[3] http://wiki.whatwg.org/wiki/Bad_Ideas
Cheers,
Kenny
--
Web Specialist, Opera Sphinx Game Force, Oupeng Browser, Beijing
Try Oupeng: http://www.oupeng.com/