Subject: Re: [boost] [xpressive] Performance Tuning?
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2009-07-06 16:27:21
Dave Jenkins wrote:
> "Stewart, Robert" <Robert.Stewart_at_[hidden]> wrote in message
> > Unfortunately, my results don't bear that out with the added
> > overhead of locating the smatch via thread local storage. I
> > see no difference between default constructing an smatch each
> > time and reusing an instance from TLS.
> It's disappointing that locating a match_results object in
> thread-local storage takes approximately the same amount of
> time as default constructing a new one. I had hoped for
Your hopes were justified: I just noticed that while my TLS accessor returns a reference to the smatch, I saved it to a copy rather than a reference where I was using it. Correcting that mistake shows the Xpressive code taking around 1.5X the time used by the custom code.
I've seen added more test cases and updated the custom code and must now correct some things in the Xpressive code to handle all of the same cases before I can do any more measurements.
> Anyway, if you don't mind spending a little more time on this,
> I'd be interested in seeing a breakdown of the amount of time
> spent on (1) locating the match_results object in TLS, (2)
> parsing, and (3) semantic actions.
With TLS, a straightforward performance test required about 68s, whereas with a function local static, it required about 65s.
Keeping the static smatch and omitting the semantic actions changed the time to about 40s.
>From that, one can conclude that the matching takes about 40s, the semantic actions add 25s, and the TLS lookups add an additional 3s, in a loop of 100,000,000 iterations.
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.