classpath
[Top][All Lists]
Advanced

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

Re: java.net.URI implementation


From: Giannis Georgalis
Subject: Re: java.net.URI implementation
Date: 10 Feb 2003 23:50:31 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Per Bothner <address@hidden> writes:
> I think space is *much* more important than speed when it comes
> to parsing URIs.  How big is the generated scanner?

The generated scanner is not big (about 300 loc).

> I'm also skeptical as to how JFlex is faster.  The only thing I
> can think of is that a generated parser might use fewer method
> calls that most hard-written parsers.  But unless you show
> a hand-written parser next to the JFlex parser, I can't tell
> whether the hand-written parser is just poorly written.

As you note, generated scanners are faster because they save a lot of
function calls, have lookup tables, and as far as I remember they
work like FSMs (finite state machines). 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*. However as I wrote
as an answer to Stephen, I'm also thinking for a hand-written parser,
for the reasons described there.

-- 
 Object-oriented programming is an exceptionally bad 
idea which could only have originated in California.
    - Edsger Dijkstra (attributed)





reply via email to

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