[erlang-questions] Speeding up string matching
James Hague
james.hague@REDACTED
Fri Sep 22 00:32:20 CEST 2006
> I think this trick will be useful for erlang starters. If not, gurus,
> please correct me :)
I discovered exactly the same trick in an XML parser I wrote earlier
this year. Speed aside, it's much cleaner to separate the scanning
and result building, too.
At one time I had a fondness for the same style of code even with
lists. Scan through the list, counting characters, then use
list:sublist/2 or lists:split/2 to get the result. The nice thing
about this approach is that there's the opportunity to move thost
standard list functions to C code. Or at least I thought this was
pretty at one time :)
James
More information about the erlang-questions
mailing list