[m-rev.] for review: speed up lexer.m

Peter Wang novalazy at gmail.com
Thu May 15 14:48:53 AEST 2008

On 2008-05-15, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
> On Wed, 14 May 2008, Peter Wang wrote:
>> Estimated hours taken: 1
>> Branches: main
>> Speed up the lexer.
>> library/io.m:
>> 	Add a version of `io.read_char' with an interface that doesn't imply
>> 	memory allocation in the usual case.
>> library/lexer.m:
>> 	Use the new predicate to read characters.
>> 	Thread the input stream through the lexer instead of looking up the
>> 	"current" input stream for each character.  (Looking up the stream
>> 	is not so trivial after it was made thread-local.)
> Do you have any timings for this?

Something like this: using term_io.read_term to read all the
compiler/*.m files concatenated together.

Before: 3.17s user 0.07s system 99% cpu 3.260 total
After:  2.44s user 0.06s system 100% cpu 2.504 total

The number of GCs drops from 35 down to 26.


mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au

More information about the reviews mailing list