[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A little compression...
On May 25, 4:21 am, Dombo <do...@disposable.invalid> wrote:
> What helps is using a profiler to identify the hotspots in your code.
> Are you sure that most time is spend in the functions below?
These functions *must* be called alot, because they are called at
nearly every position in the input file.
> The register keyword is unlikely to have any beneficial effect with most
> compilers.
So it seems.
> Instead of using array indexes in the for loop, you might
> consider using pointer arithmetic, whether you gain anything will depend
> on the compiler (untested code):
>
I did. But I'll try your method.
> You could also consider comparing 32 bit values at a time, and if the
> 32-bit values are unequal figure out which byte is not equal.
Okay.
> You could
> also consider using SSE instructions, which can compare 16 bytes at a
> time and tell you which bytes are equal.
I want it to work on a Pentium Pro, and maybe even a 386.
> However comparing multiple
> bytes at a time does make the code quite a bit more complex.
Understood.
> For C++ point of view I see little room for substantial performance
> improvement. Playing with the optimization settings of the compiler
> and/or using a more up-to-date compiler may gain some performance
> improvement, but it is very unlikely to gain orders of magnitude
> improvement. In my experience changing the algorithm is the most likely
> way to gain a substantial (orders of magnitude) performance improvement.
>
Oh. Thank you.