Closed GoogleCodeExporter closed 8 years ago
Hello François
Yes, I'm aware of this limitation, which was first underlined by Ludwig
Strigeus.
The issue was flagged as "cannot happen", since the way memory is allocated on
"common" systems (such Linux, BSD, Illumos, Windows, HPUX, etc) does not allow
an allocation range at such a low memory values.
But apparently this hypothesis is no longer valid, since you are today
triggering the issue.
The correction you propose is correct.
The issue with this correction is that it decreases speed for all other
systems, which makes it undesirable for PC/Workstation/SmartPhone.
So I guess it should be kept as a specific setting for embedded systems
(selectable with a #define).
May I ask you in which use case you are able to produce this scenario ?
Regards
Original comment by yann.col...@gmail.com
on 7 Aug 2013 at 5:29
Original comment by yann.col...@gmail.com
on 7 Aug 2013 at 6:38
OK, I made a few more tests, to properly assess the performance impact.
It appears it is much lower than anticipated. The performance cost is within
0.5% and 1%, which is small enough to be almost negligible. This is much better
than what I remember, maybe something changed since the test was done last
time, making the current version more favorable.
You'll find in attached file a development version implementing your
proposition.
Note that you took me in the middle of a big refactoring, so you may be a bit
lost when searching into the code. The current objective is to change all the
"macro" functions by "inline" derivatives. You'll find your modification inside
"lz4_inline.h".
The refactoring from macro to inline is functional, but not yet fully
finalized, so expect a bit of time before the next release (r101).
Regards
Original comment by yann.col...@gmail.com
on 7 Aug 2013 at 7:21
Attachments:
Hallo Yann,
Yes, I agree that on "normal" systems it should not happen.
We have an embedded board with a TI C6000 DSP and ARM core. Both run LZ4. We
first had an issue with the DSP compiler not correctly compiling the code and
cause incorrect compressed results. The cause was found the be the GCC
extensions. The TI DSP compiler by default do not enable GCC extensions, but
gave no warning of incorrect behavior. After the compiler switch was found and
enabled, the compression worked as expected.
During this exercise I wrote a small test program similar to the test case one
show above to demonstrate and isolate the issue. Later I reused the same test
program on the ARM since are were also seeing incorrect compression results
there as well.
That is when I started to notice the pointer issue. It was unexpected. Once I
found the cause, I also determined that it should not really be a cause of our
other issues since there we also use allocated blocks which would use higher
memory.
Ideally, I don't mind the optimization as you implemented it, but there should
be an check and/or warning somewhere to warn that the pointer value is to low.
Even if it is just an assert that is only active in debug mode. Optimization is
fine, as long as one knows where the limitations are.
Cheers
Francois
Original comment by fgret...@gmail.com
on 7 Aug 2013 at 7:47
Integrated into r101. Note that there was a second line of source code to
modify, using the same solution.
Original comment by yann.col...@gmail.com
on 12 Aug 2013 at 8:44
Original issue reported on code.google.com by
fgret...@gmail.com
on 7 Aug 2013 at 7:46