W3C home > Mailing lists > Public > public-web-perf@w3.org > November 2013

Mini-workshop topic proposal: "What can browsers do for JS game developers?"

From: Kang-Hao (Kenny) Lu <kanghaol@opera.com>
Date: Wed, 13 Nov 2013 16:25:26 +0800
Message-ID: <52833776.30005@opera.com>
To: Web Performance Working Group <public-web-perf@w3.org>
CC: Games Community Group <public-games@w3.org>
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/
Received on Wednesday, 13 November 2013 08:26:14 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 13 November 2013 08:26:15 UTC