[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: implementation

From: Per Bothner
Subject: Re: implementation
Date: Mon, 10 Feb 2003 13:47:25 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3a) Gecko/20021212

Giannis Georgalis wrote:
The generated scanner is not big (about 300 loc).

A more interesting measure is .class file size.

As you note, generated scanners are faster because they save a lot of
function calls, have lookup tables,

Lookup tables are difficult when using Unicode - a simple
one-element-per-character table is too wasteful, at least
for a non-critical helper class like URI.

and as far as I remember they
work like FSMs (finite state machines).

That does not say anything about the implementation.
A hand-written scanner is also a FSM.

Additionally don't forget
that the URI objects are immutable. That means that as soon as the
parsing is complete, the parser object is *dead*.

But you still have to allocate the parser object(s), which a
hand-written parser doesn't have to.  And object allocation
is relatively expensive, in the context of parsing a URI.
        --Per Bothner

reply via email to

[Prev in Thread] Current Thread [Next in Thread]