Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Cyan4973
Copy link
Member

@Cyan4973 Cyan4973 commented Sep 30, 2022

Direct offset values replace the former method of "virtual pointers", which could lead to UB in some complex scenarios involving a combination of HC compression, external dictionaries and low memory addresses.

As importantly, it also makes the code a bit easier to read.

The produced compressed data remains strictly bit-identical.
Performance is unchanged on M1+clang,
but it's unfortunately slightly slower on Skylake (both gcc & clang).

Even in latter case, the performance difference remains small (<5%), confined to fastest levels (3-5), and quickly unmeasurable at higher levels.

I'm tempted to favor correctness and readability over the small speed difference, given that these HC levels are not speed-sensitive (as long as performance differences remain within a few %).

Cyan4973 and others added 6 commits September 29, 2022 18:29
instead of a virtual past pointer.
instead of a virtual pointer
replaced by direct offset values.
replaced by direct offset value.
this virtual pointer was only used in rare _dstSize scenario.
this formalized better the coupling between match length and match offset
which were 2 separated variables before.
because ubsan complains even about intermediate pointer arithmetic results
(in a simple linear formula with 3 factors for example).

use parenthesis to make sure calculations go directly from one valid memory address to another valid memory address value.
@Cyan4973 Cyan4973 merged commit b9117c2 into dev Oct 1, 2022
@Cyan4973 Cyan4973 deleted the md_off branch December 29, 2022 03:08
@Cyan4973 Cyan4973 restored the md_off branch February 26, 2023 16:00
@Cyan4973 Cyan4973 deleted the md_off branch January 2, 2024 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants