On Tue, Aug 30, 2011 at 17:21, Stephan Beal <[email protected]> wrote:
> On Tue, Aug 30, 2011 at 5:17 PM, Stephan Beal <[email protected]>wrote: > >> Thanks to you both. No, i'm not suggesting that there be any optimization >> effort. i'm just curious. Most software dev managers would probably cringe >> at that amount of "duplication", but as you but say, it's not really >> duplication. >> > > But it would be interesting to get your opinions: having developed v8 this > way for so long, do you (as the developers) feel that the time spent in > platform-specific code "would have been better spent" on instead writing a > fast VM, as opposed to aggressively targeting the speed benefits of native > code? > I don't understand the question. V8 is fast precisely because of the underlying design choice to generate machine code. It's a fast VM *because* it's aggressively targeting the speed benefits of native code. Just to be clear here: the majority of V8's logic (~230K LoC) is platform independent (and implemented as such). As the last step of the compilation process, the abstract, generic, high-level instructions need to be translated to actual concrete architecture-specific machine instructions. (The whole truth is a little more complicated than a classic compiler due to JS' dynamic nature and other constraints, but this is what it boils down to.) Sure it would be possible to write a JS engine that doesn't generate machine code. That's what all browsers did until a couple of years ago. The level of performance of modern JS engines, though, cannot be achieved without compiling to native code one way or another. > > Again, i'm not arguing one way or the other, i'm just curious about how the > devs feel about it. i was always surprised at the focus of generating > machine-specific code, but as an old SpiderMonkey user i can say that the > speed benefits of v8 are very visible to clients. (When i first did some > simple benchmarks on v8, i compared it to my older SpiderMonkey code and > function calls in tight loops were 200 _times_ faster on v8.) > > -- > ----- stephan beal > http://wanderinghorse.net/home/stephan/ > > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users > -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
