|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
improving the performance of regexp(regular expressions)Hi all,
Is there a new implementation of regexp.erl or can anyone suggest a way to improve the performance of the functionalities given in the regexp.erl without using regexp library written in C. cheers chamila _______________________________________________ erlang-questions mailing list erlang-questions@... http://www.erlang.org/mailman/listinfo/erlang-questions |
|
|
Re: improving the performance of regexp(regular expressions)2008/7/1 chamila piyasena <tchamila@...>:
> Hi all, > Is there a new implementation of regexp.erl or can anyone suggest a way to > improve the performance of the functionalities given in the regexp.erl > without using regexp library written in C. Seriously: Consider something else than regular expressions if it is possible. Some languages, most notably perl has used regular expressions extensively and thus has a pretty fast implementation of them. But usually you can easily write code without them. Maybe you can read the data in a more structured format, maybe you can pre-process the data into a simpler format or maybe you can skip parts of the data. Rather than trying to brute-force yourself through the mouse-hole, use the door in the wall ;) Regular expressions have their uses, but they indeed also have their abuses. _______________________________________________ erlang-questions mailing list erlang-questions@... http://www.erlang.org/mailman/listinfo/erlang-questions |
|
|
Re: improving the performance of regexp(regular expressions)Some programmers when faced with a problem think, "I know, I'll use a
regular expression." Now they have two problems. - Anonymous _______________________________________________ erlang-questions mailing list erlang-questions@... http://www.erlang.org/mailman/listinfo/erlang-questions |
|
|
Re: improving the performance of regexp(regular expressions)Hi,
Even if I agree with the other answerers that the need to use regular expressions is often an indication that the algorithm can be improved and maybe changed to not use regular expressions at all It is worth mentioning that in the R12B-3 release there is a fast implementation of regular expressions in the re module. The regular expressions are built-in in the virtual machine and it is implemented in C. The API is still to be considered as experimental but the functionality is there and it is fast and ready to use. /Kenneth Erlang/OTP team , Ericsson 2008/7/1 chamila piyasena <tchamila@...>: > Hi all, > Is there a new implementation of regexp.erl or can anyone suggest a way to > improve the performance of the functionalities given in the regexp.erl > without using regexp library written in C. > > > > > cheers > chamila > > _______________________________________________ > erlang-questions mailing list > erlang-questions@... > http://www.erlang.org/mailman/listinfo/erlang-questions > erlang-questions mailing list erlang-questions@... http://www.erlang.org/mailman/listinfo/erlang-questions |
|
|
Re: improving the performance of regexp(regular expressions)On Tue, Jul 1, 2008 at 11:04, Kenneth Lundin <kenneth.lundin@...> wrote:
> Even if I agree with the other answerers that the need to use regular > expressions is often an indication > that the algorithm can be improved and maybe changed to not use > regular expressions at all It is worth mentioning that > in the R12B-3 release there is a fast implementation of regular > expressions in the re module. Off-topic: Well, yours is the first post trying to answer the question asked in the first place. It's very bad when a user asks a question and only gets feedback like "your way of doing it sucks." Cheers! Adam _______________________________________________ erlang-questions mailing list erlang-questions@... http://www.erlang.org/mailman/listinfo/erlang-questions |
|
|
Re: improving the performance of regexp(regular expressions)Others are probably going to say this as well, but my experience with
Erlang is that it isn't great for regex. It's great for a lot of other things, but not regex (yet!). Pre-R12B-3, I had a lot of success using pattern matches in situations where my initial reaction was to use regex. While it was a bit more code, it was a lot easier to comprehend than regex code and, through using a layer of fun() calls, it ran blazingly fast. For the specific project, I had to do a lot of (pattern matching|regex) *and* have it run as quickly as possible; from a coding perspective, what I lost in having to put together a bunch of pattern matches (in place of what would have been a single regex in e.g. Perl), I got back many times over in terms of performance in the finished product. Now that R12B-3 is here, I'll probably look at the re changes, but I've now got some experience that tells me that regex isn't the be-all and end-all of data parsing solutions. If you've got the chance, you might find it's worth looking at what you can do with pattern matching in place of regex. Regards Dave M. 2008/7/1 Jesper Louis Andersen <jesper.louis.andersen@...>: > 2008/7/1 chamila piyasena <tchamila@...>: >> Hi all, >> Is there a new implementation of regexp.erl or can anyone suggest a way to >> improve the performance of the functionalities given in the regexp.erl >> without using regexp library written in C. > > Seriously: Consider something else than regular expressions if it is > possible. Some languages, most notably perl has used regular > expressions extensively and thus has a pretty fast implementation of > them. But usually you can easily write code without them. Maybe you > can read the data in a more structured format, maybe you can > pre-process the data into a simpler format or maybe you can skip parts > of the data. > > Rather than trying to brute-force yourself through the mouse-hole, use > the door in the wall ;) > > Regular expressions have their uses, but they indeed also have their abuses. > _______________________________________________ > erlang-questions mailing list > erlang-questions@... > http://www.erlang.org/mailman/listinfo/erlang-questions > erlang-questions mailing list erlang-questions@... http://www.erlang.org/mailman/listinfo/erlang-questions |
|
|
Re: improving the performance of regexp(regular expressions)David Mitchell wrote:
> Pre-R12B-3, I had a lot of success using pattern matches in situations > where my initial reaction was to use regex. The place where a regex really shines is when it's generated at runtime. A regex literal can be replaced by code. A regex read from a configuration file is much harder to replace with code (altho less so in Erlang than some other languages). A regex read from the keyboard is almost impossible to replace with code. Sort of like XML - if you don't have CDATA that makes sense when you strip out all the <tags>, chances are you're using the wrong tool. -- Darren New / San Diego, CA, USA (PST) Helpful housekeeping hints: Check your feather pillows for holes before putting them in the washing machine. _______________________________________________ erlang-questions mailing list erlang-questions@... http://www.erlang.org/mailman/listinfo/erlang-questions |
|
|
Re: improving the performance of regexp(regular expressions)On Jul 4, 2008, at 8:53 AM, Darren New wrote: > David Mitchell wrote: >> Pre-R12B-3, I had a lot of success using pattern matches in >> situations >> where my initial reaction was to use regex. > > The place where a regex really shines is when it's generated at > runtime. > A regex literal can be replaced by code. A regex read from a > configuration file is much harder to replace with code (altho less > so in > Erlang than some other languages). A regex read from the keyboard is > almost impossible to replace with code. I think you're misinterpreting regexes. A regex _is_ code. Code in a specialized, limited-purpose, extremely concise, occasionally obscure/ obfuscated language, but code nonetheless. -kevin _______________________________________________ erlang-questions mailing list erlang-questions@... http://www.erlang.org/mailman/listinfo/erlang-questions |
|
|
Re: improving the performance of regexp(regular expressions)Kevin Scaldeferri wrote:
> I think you're misinterpreting regexes. A regex _is_ code. Fair enough, if you want to pick nits. :-) I look at it as more of a mathematical expression (or perhaps executable specification) than actual code, since it isn't Turing complete. (Of course, some of the things people call "regular expressions" aren't, either, just to close off that line of nits. ;-) -- Darren New / San Diego, CA, USA (PST) Helpful housekeeping hints: Check your feather pillows for holes before putting them in the washing machine. _______________________________________________ erlang-questions mailing list erlang-questions@... http://www.erlang.org/mailman/listinfo/erlang-questions |
| Free Forum Powered by Nabble | Forum Help |