[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is handwritten faster?
From: |
Eric Wong |
Subject: |
Re: Is handwritten faster? |
Date: |
Sat, 3 Oct 2015 02:43:08 +0000 |
"John R. Levine" <address@hidden> wrote:
> >>A more important point is that the time spent in the parser is never
> >>significant. If your compiler is simple, the bulk of the time is
> >>in the lexer since it has to touch each character in the input. If
> >>your compiler is sophisticated, it'll spend a its time in analysis and
> >>optimization.
> >
> >For scripting language implementations, I tend to disagree.
>
> I'm wondering how much of that is the parser and how much is the lexer.
Disclaimer: I'm totally new at lexers and parsers; all my other work
is in other areas of the Ruby VM.
I just tried uninlining the yylex function in Ruby but roughly 1/2 to
2/3 of that time is still in yyparse (aka ruby_yyparse) according to
"perf report" with some informal tests.
For yyparse, perf sees sees accessing the giant (over 2K) yydefact array
the main hotspot. Not sure what could be done about that with a
language as large as Ruby...