4 ms·
> I'll try rerunning the bench by adding calls to cross-product to see how it fares. btw, if you have a moment I would really appreciate if you tell me how to
by mraleph 12y ago
> I'll try rerunning the bench by adding calls to cross-product to see how it fares.
btw, if you have a moment I would really appreciate if you tell me how to reproduce +Brandon Donnelson results. It's hard to figure out from those photos which version of GWT should I get from where and what to compile with it. I was not sure if I supposed to check out Joel's code AS IS or I should get it from some other place, etc.
- cromwellian 12y agoIt's been a while, but you'll probably need to built a custom version of GWT using this patch (https://gwt-review.googlesource.com/#/c/8590/ https://gwt-review.googlesource.com/#/c/8590/) as we had to roll back the V8 optimization due to a catastrophic performance regression in IE11. Then you'll need my fork of Joel's repository here: https://github.com/cromwellian/bench2d https://github.com/cromwellian/bench2d I'm not sure they were upstreamed into his. Brandon's results were culled from the informal results I posted in Joel's G+ thread (which he independently verified). From the thread you can see I was quite disbelieving myself and not at all ready to plant a flag, I even implemented a verification in the GWT version to ensure that the final resting state of the system converged to what it was supposed to. Some very tiny patches to GWT (adding dummy random unique properties to prototypes, an optimization to HashMap.put/ArrayList.get, etc) have lead to 300-500% speedups in our benchmark server, meanwhile really complex ones actually slowed things down, or did nothing. For example, I added asmjs output to GWT (where possible in method bodies, not a truly strict-check), I also implemented an optimization which auto-converts Java classes to typedarrays where possible, e.g. class Vec3 { float x, y, z; // getters and setters } Would require the class into a bag of static methods and rewrite the field accesses into indexes into a typed array. This turned out not to be a win when benchmarked on Box2D, probably for other reasons. :(
- kevingadd 12y agoInteresting, why the dummy random unique properties? Some sort of type information/hidden class pollution workaround? Converting classes into typed arrays/typed array buffers is something that seems like it should be awesome but in practice isn't. :( I've tried it extensively in JSIL as well and it seems to only be a win if you have thousands of them in an array - for individual instances you get murdered. Maybe this will get fixed by Typed Objects if they ever land in ES.
- cromwellian 12y agoI am very interested in better ways to transform Java into asmjs, but I think we'll need typed objects and/or some way to deal with garbage collection. The latter is a particular problem, well, if we take the route we did with j2objc, we can just punt and require manual annotations to break reference cycles, implementing our own ref-counting/ARC scheme on top of typed arrays, but it would be nice if someone asmjs and GC could play nicely together, without implementing the Boehm collector. :)
- kevingadd 12y agoWell, I have a relatively firm plan to work on getting asm.js v2 + typed objects finalized and produce a proof-of-concept compiler targeting them, so hopefully I can help push them along! It'd be great to understand GWT's needs here.
- cromwellian 12y agoI didn't notice that the Typed Object spec supports "new" heap allocation, if this'll work with asmjs, than awesome. GWT's needs are primarily two fold: 1) recognize Java types that can be promoted to struct-types. GWT already knows how to do this as it has passes to convert all methods of a class to monomorphic/static dispatch, meaning the prototype only has to contain field values. Thus if a Java type has no polymorphic methods, and all fields are either primitives, or references to other 'struct' types, then the compiler can emit typed objects. 2) Since Java is a GC'ed language, GWT currently isn't in the business of implementing a memory management scheme. We rely on Javascript to do this. The current problem with strict asmjs output is we'd need to allocate typed arrays and our own memory management scheme. There's not much appetite for that right now, but I suppose it could change in the future.