Speeding up LEX scanning times

pahint@eunet.be (Pieter Hintjens)
Thu, 2 Feb 1995 06:16:59 GMT

          From comp.compilers

Related articles
Speeding up LEX scanning times pahint@eunet.be (1995-02-02)
Re: Speeding up LEX scanning times dimock@das.harvard.edu (1995-02-02)
Re: Speeding up LEX scanning times c1veeru@WATSON.IBM.COM (Virendra K. Mehta) (1995-02-02)
Re: Speeding up LEX scanning times monnier@di.epfl.ch (Stefan Monnier) (1995-02-03)
Re: Speeding up LEX scanning times mercier@hollywood.cinenet.net (1995-02-03)
Re: Speeding up LEX scanning times vern@daffy.ee.lbl.gov (1995-02-04)
Re: Speeding up LEX scanning times eifrig@beanworld.cs.jhu.edu (1995-02-07)
| List of all articles for this month |
Newsgroups: comp.compilers
From: pahint@eunet.be (Pieter Hintjens)
Keywords: lex, question, comment
Organization: EUnet Belgium, Leuven, Belgium
Date: Thu, 2 Feb 1995 06:16:59 GMT

I'm writing a Cobol parser, using MKS Lex and Yacc. So far so good.
However, on seriously large programs, it is quite slow. When I profiled
the code, I noticed that about 80% of the time was in the Lex scanner.
Now, I found that the standard C functions for file access (fread) are
a lot slower than the non-standard read functions, so I shaved off
some time by using these if the compiler supports them.


However, I still find that the scanner is slow. I don't think I made
any mistakes; for instance all keywords are identified by looking-up
a table, rather than as individual scanner tokens.


So my question is: should I consider writing the scanner by hand,
now that I have a working prototype? If so, are there any techniques
I should be aware of?


--
Pieter A. Hintjens
[I believe that flex is a lot faster than other versions of lex. Try that.
-John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.