Regex matching cause lots of _d_arrayliteralTX calls

JR zorael at gmail.com
Thu Sep 26 15:00:45 PDT 2013


I'm working on a toy IRC bot. Much of the logic involved is 
translating the incoming raw IRC string into something that makes 
sense (so now I have two problems, etc). But I managed to cook up 
a regex that so far seems to work well. Time for callgrind!

Grouped by source file, most time is spent in regex.d (as would 
seem natural) but more time is spent in gc.d than I would have 
expected. Looking at the callgraph I see that there's a curious 
amount of calls to _d_arrayliteralTX from (around) where the 
regex matching is done. (There's some inlining going on.)

Example:   http://dpaste.dzfl.pl/3932a231 (needs dmd head)

Callgraph: http://i.imgur.com/AZEutCE.png

TL;DR: 67 regex matches are done in that example snippet, on real 
but (hopefully) anonymized raw irc strings; _d_arrayliteralTX 
sees 800+ calls.

Is this working as expected? Or am I doing it wrong?


(In one of the instances currently running the figures are 2_162 
and 111_708, or a ratio of not quite 1:52.)


More information about the Digitalmars-d-learn mailing list