Related articles |
---|
[15 earlier articles] |
Re: Buffered input for a lexer? ralph@inputplus.co.uk (2002-04-16) |
Re: Buffered input for a lexer? joachim_d@gmx.de (Joachim Durchholz) (2002-04-16) |
Re: Buffered input for a lexer? cgweav@aol.com (2002-04-17) |
Re: Buffered input for a lexer? rhyde@cs.ucr.edu (Randall Hyde) (2002-04-19) |
Re: Buffered input for a lexer? monnier+comp.compilers/news/@RUM.cs.yale.edu (Stefan Monnier) (2002-04-19) |
Re: Buffered input for a lexer? rhyde@cs.ucr.edu (Randall Hyde) (2002-04-20) |
Re: Buffered input for a lexer? joachim_d@gmx.de (Joachim Durchholz) (2002-04-23) |
Re: Buffered input for a lexer? bear@sonic.net (Ray Dillinger) (2002-04-23) |
Re: Buffered input for a lexer? rhyde@cs.ucr.edu (Randall Hyde) (2002-04-23) |
From: | Joachim Durchholz <joachim_d@gmx.de> |
Newsgroups: | comp.compilers |
Date: | 23 Apr 2002 00:01:49 -0400 |
Organization: | Compilers Central |
References: | 02-04-061 02-04-081 02-04-097 02-04-116 02-04-117 02-04-121 |
Keywords: | lex, performance |
Posted-Date: | 23 Apr 2002 00:01:49 EDT |
Randall Hyde wrote:
>
> Two machine instructions may not seem like much, but when you go from
> four to six instructions, it can be a problem (50% more instructions,
> or 33% fewer instructions, depending upon which direction you want to
> view it).
You should be able to cut that overhead down to one instruction by
doing a compare-and-branch of the "current character pointer" against
the address of the last memory-mapped byte. (I haven't read the
assembly, so I may be off the mark here. If you don't have any
registers left in your read loop, it's probably not going to be fast
enough for your taste.)
Actually my language is (will be) much more high-level than assembly,
so I either have to spend a lot of time with optimization, or be
content with a slow executable. In both cases, lexer speed is one of
my lest concerns. Which leads me to the question what's "fast enough"
for an assembler. Is 10kLOC/s enough? Do you need more? Is less
acceptable - and if so, *how much* less? How much of an improvement is
the speed really worth?
Joachim
Return to the
comp.compilers page.
Search the
comp.compilers archives again.