kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #28398
Re: RICHIO performance - 3 to 30 times slower than std::ifstream
Hey John,
Does this patch get applied on top of the previous patch or does it
replace the previous patch.
Thanks,
Wayne
On 3/2/2017 12:31 AM, John Beard wrote:
> Hi Wayne,
>
> Sorry for the delay, I've been a bit distracted by other things. The
> attached patch adds io_benchmark as a new target under tools. For now,
> it only includes LINE_READER input benchmarks.
>
> It currently supports:
>
> * Existing FILE_LINE_READERs
> * Raw std::ifstream reading (with getline, so no line length limits)
> * LINE_READER based on std::istream, ditto for line length limits, and
> providing a simple ifstream implementation (pass a filename)
> * wxInputStream LINE_READERs, for both File and FFile variants.
>
> Running this on Linux, on a 6.4MB file made by concatenaing all .lib
> files in the kicad library (for somewhat realistic data), gives:
>
> IO Bench Mark Util
> Benchmark file: /tmp/all.lib
> Repetitions: 5
>
> std::fstream 794645 lines, acc: 62758460 in 41 ms
> std::fstream, reused 794645 lines, acc: 62758460 in 41 ms
> RICHIO 794645 lines, acc: 62758460 in 224 ms
> RICHIO, reused 794645 lines, acc: 62758460 in 223 ms
> std::ifstream L_R 794645 lines, acc: 62758460 in 54 ms
> std::ifstream L_R, reused 794645 lines, acc: 62758460 in 52 ms
> wxIStream 794645 lines, acc: 62758460 in 8817 ms
> wxIStream, reused 794645 lines, acc: 62758460 in 9115 ms
> wxFFIStream 794645 lines, acc: 62758460 in 1444 ms
> wxFFIStream, reused 794645 lines, acc: 62758460 in 1441 ms
>
> Note that this only considers the LINE_READER classes, which are the
> right tool when reading line-based formats like .lib, but not really
> for things like sexp which don't have to have line breaks at all, or
> if they do, don't have to put them in "friendly" places. But that's
> the parser's problem!
>
> Cheers,
>
> John
>
> On Thu, Mar 2, 2017 at 7:31 AM, Wayne Stambaugh <stambaughw@xxxxxxxxx> wrote:
>> On 2/19/2017 4:27 AM, John Beard wrote:
>>> On Sat, Feb 18, 2017 at 1:08 AM, Nox <noxfiregalaxy@xxxxxxxxx> wrote:
>>>> What about wxFFileInputStream instead of wxFileInputStream?
>>>>
>>>
>>> wxFFileInputStream appears to be about 5-6 times faster than
>>> wxFileInputStream, but that's still much much slower than RICHIO or
>>> std::ifstream.
>>>
>>> $ qa/io_benchmark/io_benchmark /tmp/all.lib 2
>>> IO Bench Mark Util
>>> Benchmark file: /tmp/all.lib
>>> Repetitions: 2
>>> std::fstream 317858 lines, acc: 25103384 in 16 ms
>>> std::fstream, reused 317858 lines, acc: 25103384 in 16 ms
>>> RICHIO 317858 lines, acc: 25103384 in 91 ms
>>> RICHIO, reused 317858 lines, acc: 25103384 in 90 ms
>>> New fstream IO 317858 lines, acc: 25103384 in 19 ms
>>> New fstream IO, reused 317858 lines, acc: 25103384 in 19 ms
>>> wxIStream 317858 lines, acc: 25103384 in 3558 ms
>>> wxIStream, reused 317858 lines, acc: 25103384 in 3429 ms
>>> wxFFIStream 317858 lines, acc: 25103384 in 589 ms
>>> wxFFIStream, reused 317858 lines, acc: 25103384 in 602 ms
>>>
>>
>> John,
>>
>> Did you create a patch for your wxInputStream benchmarking code? I
>> would like to merge this. I think it would be a useful tool for developers.
>>
>> Thanks,
>>
>> wayne
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help : https://help.launchpad.net/ListHelp
Follow ups
References