spirit for the speed win?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

spirit for the speed win?

Mike Beachy

Hi -

I am in the process of rewriting a legacy file parser for the (almost) sole purpose of making it faster. The format is the moral equivalent of JSON but has some space-separated table-style sections like the following:

1 1.7 "row one"

2 2.1 "row two" 

3 1.7 "row three"

4 null "row four"

etc.

Columns are typed and any value can be null. Ultimately I want vectors of columns with dynamic_bitsets of null settings (or vectors of blank/value variants?).

These sections are the bulk of the data (70-90%?) in the file and so the only part that really matters when it comes to speed. I have a preliminary hand written recursive descent solution that I've done some profiling on, and have found that strtod/atof is about 20% of my overhead and I will get at best a 2x speedup over the legacy parser.

In the course of investigating ways to speed up my doubles parsing I came across the Spirit benchmarks for float parsing. I have been poking around a bit and trying out the examples.

I recognize that it's an impossible question to answer without you looking at my hand written parser, but I'm wondering if there's any hope that switching over to spirit completely will give me additional advantages in speed. I guess I'm looking for rules of thumb in when I'll get a speed advantage over a hand written parser.

Any thoughts would be appreciated.

Thanks,

Mike


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|

Re: spirit for the speed win?

teajay-2
Le 30/04/2015 05:15, Mike Beachy a écrit :

> Hi -
>
> I am in the process of rewriting a legacy file parser for the (almost)
> sole purpose of making it faster. The format is the moral equivalent of
> JSON but has some space-separated table-style sections like the following:
>
> 1 1.7 "row one"
>
> 2 2.1 "row two"
>
> 3 1.7 "row three"
>
> 4 null "row four"
>
> etc.
>
> Columns are typed and any value can be null. Ultimately I want vectors
> of columns with dynamic_bitsets of null settings (or vectors of
> blank/value variants?).
>
> These sections are the bulk of the data (70-90%?) in the file and so the
> only part that really matters when it comes to speed. I have a
> preliminary hand written recursive descent solution that I've done some
> profiling on, and have found that strtod/atof is about 20% of my
> overhead and I will get at best a 2x speedup over the legacy parser.
>
> In the course of investigating ways to speed up my doubles parsing I
> came across the Spirit benchmarks for float parsing. I have been poking
> around a bit and trying out the examples.
>
> I recognize that it's an impossible question to answer without you
> looking at my hand written parser, but I'm wondering if there's any hope
> that switching over to spirit completely will give me additional
> advantages in speed. I guess I'm looking for rules of thumb in when I'll
> get a speed advantage over a hand written parser.
>
> Any thoughts would be appreciated.
>
> Thanks,
>
> Mike
>

Hello Mike,

You might be interested in this article :
https://code.google.com/p/scribblings-by-apoch/wiki/OptimizingBoostSpirit

 From my experience, the main parsing costs are in order:

- memory management (container allocation, copy etc ...) : for this,
spirit is really good, but you have to take when designing the parser
and the data structures.

- parser back tracking : this really depends on the syntax you are
trying to parse and the way the parser deals with alternatives, to speed
things up on this side, you'll need to look at using a lexer, but in
most cases it won't be necessary.

- string to number conversion: in this domain, spirit is also very
efficient, there's not much room left here to optimize.

Hope this helps.

Regards,

Thomas Bernard

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general