Hi Phil, On Mon, Sep 8, 2008 at 5:23 AM, Phil Dawes <[EMAIL PROTECTED]> wrote: > Hi Slava, > > I was just wondering what your thoughts were on the trendy 'tracing' jit > compilation technique used in mozillas new javascript engine?
I think tracing is a very interesting technique and I'm curious to see how it turns out in practice. So far I've only seen two projects use this technique: TraceMonkey and LuaJIT2. I'm interested in seeing how both progress over time. > - static type hints not required This is certainly a benefit. > - maybe simpler implementation Hmm. Have you seen the code to TraceMonkey? :-) > - faster initial compile > - smaller code footprint (code not inlined/specialised until hot loops > detected at runtime). These two are also clear benefits of tracing. Static compilation as in Factor has some advantages over tracing too. First of all, we can strip the compiler out of deployed applications. Second, while compile time is still imporant (and Factor's compiler is still too slow), it is not absolutely critical as it is with tracing. Part of the reason tracing JITs are so complex is because they're usually written in systems languages such as C++ which lack many of the abstractions that I take for granted with Factor, and because the compiler itself needs many low-level optimizations which obfuscate the code. Not having to worry about compile time beyond choosing good algorithms is very nice for maintainability. For the forseeable future I intend to work on static analysis and take it as far as it can go. There are still many improvements in the pipeline. At some stage I may implement polymorphic inline caching for method dispatch. This is simpler than tracing because there is no runtime recompilation or dynamic deoptimization, however you get many of the same benefits: method dispatch overhead in 'hot' loops is reduced and no static type hints are required. The SquirrelFish JavaScript implementation is a pretty simple direct-threaded interpreter with PICs and yet it is about as fast as TraceMonkey and V8. So while tracing is an interesting technique, there are other, simpler ways to improve performance on highly-dynamic code. Hopefully more advanced static analysis and PICs will give the Factor compiler competitive performance in the long term. Once things settle down a bit I intend to do some benchmarking against some of the newer dynamic language implementations that have been coming out, as well as the more established ones such as SBCL. > This isn't a feature request or anything daft like that, I'm just > interested in your thoughts as somebody who has put a lot of time into > thinking about compilation. If you want to try implementing tracing, go ahead :-) Slava ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Factor-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/factor-talk
