Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR attempts to measure the performance impact of #890 as discussed in #894 (comment). I just introduced a performance profiling test in #923 which we will use to compare.
The current stats from most recent commit (0191e29) on
mainare as follows:encode: 207.0729 / decode: 472.8765
https://github.com/jcrist/msgspec/actions/runs/19278707083/job/55124831438
encode: 208.4342 / decode: 473.5738
https://github.com/jcrist/msgspec/actions/runs/19278707083/job/55151162634
encode: 203.9945 / decode: 475.7701
https://github.com/jcrist/msgspec/actions/runs/19278707083/job/55213730802
The first commit of this PR (
39679f2(#927)) reverts the relevant code changes to the state before StructMeta was exposed (7acceff). I manually removed the import insrc/msgspec/__init__.pyand then ran:encode: 201.8113 / decode: 470.4537
https://github.com/jcrist/msgspec/actions/runs/19279043046/job/55125796315
encode: 201.3001 / decode: 470.7170
https://github.com/jcrist/msgspec/actions/runs/19279043046/job/55150123158
encode: 202.9358 / decode: 471.8717
https://github.com/jcrist/msgspec/actions/runs/19279043046/job/55150356878
The second commit of this PR (
12ca746(#927)) adds back the StructMeta changes but leaves the older conditional statements.encode: 202.0596 / decode: 465.4165
https://github.com/jcrist/msgspec/actions/runs/19279328219/job/55126685658
encode: 202.1670 / decode: 467.7030
https://github.com/jcrist/msgspec/actions/runs/19279328219/job/55220713879
encode: 200.9772 / decode: 469.2514
https://github.com/jcrist/msgspec/actions/runs/19279328219/job/55221019147
The third commit of this PR (
b0034bf(#927)) only adds back the Python import of StructMeta insrc/msgspec/__init__.py, in case that for some reason makes a difference.encode: 203.1143 / decode: 471.9352
https://github.com/jcrist/msgspec/actions/runs/19279428342/job/55127014303
encode: 205.6086 / decode: 469.1426
https://github.com/jcrist/msgspec/actions/runs/19279428342/job/55219914604
encode: 203.7604 / decode: 472.6652
https://github.com/jcrist/msgspec/actions/runs/19279428342/job/55220536395
The fourth commit of this PR (
90cfce6(#927)) restored the final 2 code files to the way they are onmain. Then, insrc/msgspec/_core.cI tried refactoring the conditional logic a bit to be more maintainable/DRY.encode: 204.3880 / decode: 487.9419
https://github.com/jcrist/msgspec/actions/runs/19280475608/job/55130310717
encode: 204.3767 / decode: 479.7496
https://github.com/jcrist/msgspec/actions/runs/19280475608/job/55130695429
encode: 188.4990 / decode: 441.3936
https://github.com/jcrist/msgspec/actions/runs/19280475608/job/55219760315
encode: 200.0785 / decode: 478.5824
https://github.com/jcrist/msgspec/actions/runs/19280475608/job/55221584281
encode: 202.2184 / decode: 481.9860
https://github.com/jcrist/msgspec/actions/runs/19280475608/job/55222104467
The fifth commit of this PR (
2e79e6e(#927)) improves the previous refactor to be faster.encode: 204.4297 / decode: 473.7804
https://github.com/jcrist/msgspec/actions/runs/19284323563/job/55141735437
encode: 206.1753 / decode: 475.5152
https://github.com/jcrist/msgspec/actions/runs/19284323563/job/55142261913
encode: 206.0142 / decode: 472.8009
https://github.com/jcrist/msgspec/actions/runs/19284323563/job/55142778982
encode: 192.2017 / decode: 442.4200
https://github.com/jcrist/msgspec/actions/runs/19284323563/job/55221462586
encode: 204.8113 / decode: 474.8899
https://github.com/jcrist/msgspec/actions/runs/19284323563/job/55221890208
Commits
de51303(#927) &21da11e(#927) introduce a final implementation of the helpers that optimizes in the case of subclasses.encode: 189.0633 / decode: 444.3397
https://github.com/jcrist/msgspec/actions/runs/19320644266/job/55261304734
encode: 202.6852 / decode: 472.9807
https://github.com/jcrist/msgspec/actions/runs/19320644266/job/55261459898
encode: 203.8291 / decode: 470.4672
https://github.com/jcrist/msgspec/actions/runs/19320644266/job/55261700792
encode: 202.9539 / decode: 472.7815
https://github.com/jcrist/msgspec/actions/runs/19320644266/job/55261836412
encode: 204.2903 / decode: 476.9618
https://github.com/jcrist/msgspec/actions/runs/19320644266/job/55262300900