Skip to content

Make lock behavior controllable, add xxhash.threadsafe submodule, and clean up#162

Open
ifduyue wants to merge 17 commits into
masterfrom
no-lock
Open

Make lock behavior controllable, add xxhash.threadsafe submodule, and clean up#162
ifduyue wants to merge 17 commits into
masterfrom
no-lock

Conversation

@ifduyue

@ifduyue ifduyue commented Jun 20, 2026

Copy link
Copy Markdown
Owner
  • Remove deprecated VERSION_TUPLE and bump version to 4.0.0.dev0
  • Make _xxhash.c lock behaviour controllable via XXHASH_WITH_LOCK and support a parameterized module name
  • Build both _xxhash and _xxhash_threadsafe extensions; default is locked on free-threading builds
  • Add xxhash.threadsafe submodule backed by the locked _xxhash_threadsafe extension
  • Update thread-safety tests to use xxhash.threadsafe
  • Document thread-safety model and the new xxhash.threadsafe submodule
  • Unify behaviour across GIL and free-threading builds: default module is always unlocked
  • Declare both extension variants as Py_MOD_GIL_NOT_USED on Python 3.13+
  • Use set literal syntax instead of set([...])
  • Remove empty if (!kwargs) branch in _parse_init_args
  • Fix typo: synchronisation -> synchronization
  • Update XXHASH_DO_UPDATE comment to describe both locked and unlocked paths
  • Document why build_ext restores self.build_temp in try/finally
  • Macro-generate the 4 update() methods via XXHASH_UPDATE_METHOD
  • Align trailing backslashes in multi-line macros
  • Remove Py_ALWAYS_INLINE

@ifduyue ifduyue changed the title no lock Make lock behavior controllable, add xxhash.threadsafe submodule, and clean up Jun 20, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request optimizes performance by making the default streaming hash objects in xxhash non-thread-safe by default, removing per-object locking overhead. A new xxhash.threadsafe submodule is introduced to provide thread-safe streaming hash objects with per-object locks. The C extension src/_xxhash.c is refactored to support compiling both variants (_xxhash and _xxhash_threadsafe) from the same source, and setup.py is updated to build both extensions. Additionally, the deprecated VERSION_TUPLE is removed, and the package version is bumped to 4.0.0.dev0. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@codspeed-hq

codspeed-hq Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 148 untouched benchmarks
⏩ 66 skipped benchmarks1


Comparing no-lock (e960610) with master (deb8919)

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.

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