Le jeudi 23 avril 2015 [email protected] a écrit ceci : > > > Although not recommended in general, this solution will deliver decent > > > performance in your case. > > > > As the system we try to emulate is a Python library, the performance > > should be comparable. > > > > > The other solution would be to use pregexp (your first intuition) but > > > as pregexp requires a string, you will have to read the whole file in > > > memory first, which means that this solution will only work for toy > > > examples. > > > > > As a side note, if your pattern is basic regular expression only made > > > of sequences of characters, then you might prefer using KPM and mmap. > > > > KMP, I suppose? We need Regexps more complex than just strings. But I am > Yes. Sorry for the typo. KMP. > > > curious about the way Perl manages multi-lines queries, we would do the > > same. > > If the pattern you are looking for is statically known, then of course, > compile the grammar. This will deliver the best result. My guess is that > is it will be significantly faster then traditional regular expressions, > but this has to be verified.
And what about mmap + pregexp-match ? Cheers! -- Laurent Bloch - http://www.laurentbloch.org - [email protected] Tél. mob. : 06 03 12 16 97 - priv. : 01 43 14 04 55 - GPG : 45534C55 Le ciel se rit des prières qu'on lui fait pour détourner de soi des maux dont on persiste à vouloir les causes. (B)
signature.asc
Description: PGP signature
