Regex matching cause lots of _d_arrayliteralTX calls
JR
zorael at gmail.com
Thu Sep 26 16:51:51 PDT 2013
On Thursday, 26 September 2013 at 23:04:22 UTC, bearophile wrote:
> I am not sure how a IRC bot could consume more than a tiny
> fraction of the CPU time of a modern multi-GHz processor.
Nor does it bite into my 8 gigabytes of ram.
Forgive me, but the main culprit in all of this is still me doing
it wrong. Can I keep the same RegexMatcher (perhaps as a struct
member) and reuse it between matchings?
> And I am not sure if regular expressions are a good idea to
> implement a IRC interface.
I dare say I disagree!
As input you get strings which all contain two to ~five nuggets
of information, where your only two immediately clues are that
the first character will show if it's an off case (namely PING
and ERROR), and that the second field as delimeted by whitespace
-- ^[^ ]+ ([^ ]+).* -- will be the type/action of the event. What
comes next is highly type-specific and with seemingly ad-hoc
placement at times, but can be made sense of either with some
regex, or in an std.algorithmic slicefest with extra countUntils
for all.
More information about the Digitalmars-d-learn
mailing list