Re: Re: Bundling libxml2 and expat compatibility layer

From: Date: Sun, 04 May 2003 19:33:38 +0000
Subject: Re: Re: Bundling libxml2 and expat compatibility layer
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-1241@lists.php.net to get a copy of this message
On Sun, 2003-05-04 at 16:04, Dmitri Dmitrienko wrote: > Sterling, > > > Uhh, flex, while easier to write, would be slower in this case. > > That's only words and your own impression. > Try and compare. You'll see that you are wrong. > > Compare with php lexer. It takes only 3-4 ms to parse 1M of awesome php > source. > It's because of Flex's power. Without Flex you would write the first > adequate php lexer till today. > Dmitri, Have you tried and compared? How do you know your right? A well written hand lexer will always be faster. Not only has it been shown (python, for example uses a custom coded scanner for speed), but it makes logical sense. First, flex builds LFA trees, which will always be slower matches then a custom built matcher. Second, flex can't be as intelligent about buffer handling as a custom parser could be. The problem is, usually its just not worth the time to build a custom scanner. It's much easier to use flex, which is very fast, to efficiently parse the document. In the case of XML, however, parsing must be efficient, and XML is a relatively uncomplex technology when it comes to the base scanning routines. Anyhow, this is offtopic, let it die. -Sterling

« previous php.internals (#1241) next »