Skip to content

Unify lock allocation and GIL release thresholds - #186

Merged
ifduyue merged 2 commits into
masterfrom
fix/unify-gil-threshold
Aug 12, 2026
Merged

Unify lock allocation and GIL release thresholds#186
ifduyue merged 2 commits into
masterfrom
fix/unify-gil-threshold

Conversation

@ifduyue

@ifduyue ifduyue commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

Align the lazy lock allocation threshold with the GIL release threshold in _xxhash.c.

Changes

  • src/_xxhash.c: XXHASH_LOCK_MAYBE_INIT allocated the lock at >= XXHASH_GIL_MINSIZE while every GIL release check uses >, so an update of exactly 64KB allocated a lock that was never used. Both now use > XXHASH_GIL_MINSIZE
  • README.rst: update the thread-safety wording to match ("more than 64KB", "operations of 64KB or less")
  • Bump version to 4.0.0.dev8

Testing

  • Boundary behavior verified at 64KB-1 / 64KB / 64KB+1 (results match the one-shot equivalents)
  • Full test suite passes (132 tests)

XXHASH_LOCK_MAYBE_INIT allocated the lock at >= XXHASH_GIL_MINSIZE
while every GIL release check uses >, so an update of exactly 64KB
allocated a lock that was never used.  Align both at > XXHASH_GIL_MINSIZE
and update the README wording.
@codspeed-hq

codspeed-hq Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 148 untouched benchmarks
⏩ 66 skipped benchmarks1


Comparing fix/unify-gil-threshold (f0b2b5b) with master (b274f52)

Open in CodSpeed

Footnotes

  1. 66 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@ifduyue
ifduyue merged commit 88fe191 into master Aug 12, 2026
84 of 86 checks passed
@ifduyue
ifduyue deleted the fix/unify-gil-threshold branch August 12, 2026 15:59
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.

1 participant