Skip to content

Commit ec5fdcd

Browse files
authored
lib: add hint to generate more pipeline friendly code (#3138)
With statistic data of test data files of silesia the chance of position beyond highThreshold is very low (~1.3%@L8 in most cases, all <2.5%), and is in "lowprob area". Add the branch hint so compiler can get better pipiline codegen. With this change it is observed ~1% of mozilla and xml, and slight (0.3%~0.8%) but consistent uplift on other files on Arm N1. Signed-off-by: Jun He <[email protected]> Change-Id: Id9ba1d5c767e975290b5c1bf0ecce906544f4ade
1 parent 558cf20 commit ec5fdcd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/decompress/zstd_decompress_block.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ void ZSTD_buildFSETable_body(ZSTD_seqSymbol* dt,
543543
for (i=0; i<n; i++) {
544544
tableDecode[position].baseValue = s;
545545
position = (position + step) & tableMask;
546-
while (position > highThreshold) position = (position + step) & tableMask; /* lowprob area */
546+
while (UNLIKELY(position > highThreshold)) position = (position + step) & tableMask; /* lowprob area */
547547
} }
548548
assert(position == 0); /* position must reach all cells once, otherwise normalizedCounter is incorrect */
549549
}

0 commit comments

Comments
 (0)