Skip to content

Numba perf - #3255

Merged
benjeffery merged 1 commit into
tskit-dev:mainfrom
benjeffery:numba-perf
Aug 19, 2025
Merged

benjeffery merged 1 commit into
tskit-dev:mainfrom
benjeffery:numba-perf

Conversation

@benjeffery

Copy link
Copy Markdown
Member

Stacked on #3225

These changes in 6fa1f9c give a 25% time reduction for the JIT code for diversity on chr 21 of the simulated French Canadians.

Python API: ~34s
This branch: ~20s

Making site and mutation tracking optional is just under half of the improvement, add the cost of having an additional option.

@codecov

codecov Bot commented Aug 13, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.72%. Comparing base (d1eb1b4) to head (6c83d5f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3255   +/-   ##
=======================================
  Coverage   89.72%   89.72%           
=======================================
  Files          29       29           
  Lines       32500    32501    +1     
  Branches     5949     5949           
=======================================
+ Hits        29160    29161    +1     
  Misses       1894     1894           
  Partials     1446     1446           
Flag Coverage Δ
c-tests 86.71% <ø> (ø)
lwt-tests 80.38% <ø> (ø)
python-c-tests 88.24% <ø> (ø)
python-tests 98.79% <ø> (ø)
python-tests-no-jit 32.62% <100.00%> (+<0.01%) ⬆️
python-tests-numpy1 50.99% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
python/tskit/jit/numba.py 97.92% <100.00%> (+0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jeromekelleher

Copy link
Copy Markdown
Member

What's the other half of the perf improvement from? I'm not sure making indexing sites and mutations is worth the complexity - we're already competitive with the C code, right?

@benjeffery

benjeffery commented Aug 14, 2025 •

Copy link
Copy Markdown
Member Author

Agreed that the added complexity isn't worth the bother, but was worth checking. The other half comes from caching the child/parent lookups. We're already at 76% of the time the C code (called via Python) without these changes.

@benjeffery

Copy link
Copy Markdown
Member Author

Rebased to the final version of #3225 and reduced to just the algorithm tweaks in d73191b, these give about an 18% reduction in time on chr21 of the French canadians.

@benjeffery

Copy link
Copy Markdown
Member Author

@jeromekelleher Can I get a tick here to make the merge queue happy?

@benjeffery
benjeffery added this pull request to the merge queue Aug 19, 2025
Merged via the queue into tskit-dev:main with commit 2a4ec4f Aug 19, 2025
@benjeffery benjeffery mentioned this pull request Sep 22, 2025
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