Class size and performance
Unknown W. Brackets
unknown at simplemachines.org
Sun Jan 20 17:45:19 PST 2008
Daniel Lewis,
Actually, I made a mistake. That's running the parsing 50 or 75 times
(I can't remember now.) So it was actually only like 14,500 objects per
parsing.
Yes, it's true that most parsing does not require such a large number of
objects (and a 200 kilobyte file as I'm talking about here really
shouldn't need so many.) However, I'm not parsing a configuration file
or even a command file. In my case it does really need that many
objects (this is the purpose of parsing.)
My parser is actually designed to work on an incoming stream, parse on
the fly in chunks, and according to my benchmarks against similar
parsers, is quite fast already.
Even so, that is interesting. My parser works similarly in some ways to
yours (switches and parseXYZ functions.)
-[Unknown]
Daniel Lewis wrote:
> Sir, I'm not sure about the GC, but I can say that your program probably doesn't need to create 728,000 objects to parse an input stream.
>
> I'm writing a parser too at the moment; it's a rather experimental, oddly written one though. It [should] perform tokenization and parsing in a single O(1) pass for the ECMAScript language.
>
> Take a look if you're interested;
> http://dsource.org/projects/walnut/browser/branches/1.9/source/interpreter.d
>
> Regards,
> Dan
More information about the Digitalmars-d-learn
mailing list