Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Korijn
Copy link
Collaborator

@Korijn Korijn commented Feb 10, 2025

Split off from #972 to make it easier to review. When this PR is merged, #972 will be purely about cache reuse.

This PR only optimizes code paths by using less intermediate arrays.

@Korijn Korijn mentioned this pull request Feb 10, 2025
@Korijn Korijn requested a review from almarklein February 10, 2025 08:41
@Korijn
Copy link
Collaborator Author

Korijn commented Feb 10, 2025

Running some tests locally I can't measure a significant performance difference between main vs this branch. That matches my expectations, the changes here are pretty neutral, it's really just cleaning up and using slightly less arrays.

I'm ready to merge this one.

@almarklein almarklein merged commit 83961d0 into main Feb 11, 2025
14 checks passed
@almarklein almarklein deleted the transform-cleanup branch February 11, 2025 08:30
@hmaarrfk
Copy link
Contributor

Forgot to report, it seems like the gains are small, but maybe measurable depending on how you want to interpret my benchmarks:

$ for i in $(seq 1 10); do (cd /home/mark/git//pygfx && git checkout main && git describe --tags) && python benchmarks/bm_transforms.py && (cd /home/mark/git//pygfx && git checkout transform-cleanup && git describe --tags) && python benchmarks/bm_transforms.py; done


Switched to branch 'main'
Your branch is up to date with 'origin/main'.
v0.7.0-29-g29ea9a1
    bm_transforms_100_children (20x) - cpu:  0.00 ms
   bm_transforms_1000_children (20x) - cpu:  0.01 ms
bm_transforms_1000_children_with_50_grandchildren (20x) - cpu:  2.13 ms
Switched to branch 'transform-cleanup'
Your branch is up to date with 'upstream/transform-cleanup'.
v0.7.0-31-g8ac61c9
    bm_transforms_100_children (20x) - cpu:  0.00 ms
   bm_transforms_1000_children (20x) - cpu:  0.01 ms
bm_transforms_1000_children_with_50_grandchildren (20x) - cpu:  2.12 ms
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
v0.7.0-29-g29ea9a1
    bm_transforms_100_children (20x) - cpu:  0.00 ms
   bm_transforms_1000_children (20x) - cpu:  0.01 ms
bm_transforms_1000_children_with_50_grandchildren (20x) - cpu:  2.21 ms
Switched to branch 'transform-cleanup'
Your branch is up to date with 'upstream/transform-cleanup'.
v0.7.0-31-g8ac61c9
    bm_transforms_100_children (20x) - cpu:  0.00 ms
   bm_transforms_1000_children (20x) - cpu:  0.01 ms
bm_transforms_1000_children_with_50_grandchildren (20x) - cpu:  2.06 ms
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
v0.7.0-29-g29ea9a1
    bm_transforms_100_children (20x) - cpu:  0.00 ms
   bm_transforms_1000_children (20x) - cpu:  0.02 ms
bm_transforms_1000_children_with_50_grandchildren (20x) - cpu:  2.36 ms
Switched to branch 'transform-cleanup'
Your branch is up to date with 'upstream/transform-cleanup'.
v0.7.0-31-g8ac61c9
    bm_transforms_100_children (20x) - cpu:  0.00 ms
   bm_transforms_1000_children (20x) - cpu:  0.01 ms
bm_transforms_1000_children_with_50_grandchildren (20x) - cpu:  2.15 ms
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
v0.7.0-29-g29ea9a1
    bm_transforms_100_children (20x) - cpu:  0.00 ms
   bm_transforms_1000_children (20x) - cpu:  0.02 ms
bm_transforms_1000_children_with_50_grandchildren (20x) - cpu:  2.18 ms
Switched to branch 'transform-cleanup'
Your branch is up to date with 'upstream/transform-cleanup'.
v0.7.0-31-g8ac61c9
    bm_transforms_100_children (20x) - cpu:  0.00 ms
   bm_transforms_1000_children (20x) - cpu:  0.01 ms
bm_transforms_1000_children_with_50_grandchildren (20x) - cpu:  2.21 ms
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
v0.7.0-29-g29ea9a1
    bm_transforms_100_children (20x) - cpu:  0.00 ms
   bm_transforms_1000_children (20x) - cpu:  0.01 ms
bm_transforms_1000_children_with_50_grandchildren (20x) - cpu:  2.18 ms
Switched to branch 'transform-cleanup'
Your branch is up to date with 'upstream/transform-cleanup'.
v0.7.0-31-g8ac61c9
    bm_transforms_100_children (20x) - cpu:  0.00 ms
   bm_transforms_1000_children (20x) - cpu:  0.01 ms
bm_transforms_1000_children_with_50_grandchildren (20x) - cpu:  2.21 ms
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
v0.7.0-29-g29ea9a1
    bm_transforms_100_children (20x) - cpu:  0.00 ms
   bm_transforms_1000_children (20x) - cpu:  0.01 ms
bm_transforms_1000_children_with_50_grandchildren (20x) - cpu:  2.14 ms
Switched to branch 'transform-cleanup'
Your branch is up to date with 'upstream/transform-cleanup'.
v0.7.0-31-g8ac61c9
    bm_transforms_100_children (20x) - cpu:  0.00 ms
   bm_transforms_1000_children (20x) - cpu:  0.02 ms
bm_transforms_1000_children_with_50_grandchildren (20x) - cpu:  2.17 ms
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
v0.7.0-29-g29ea9a1
    bm_transforms_100_children (20x) - cpu:  0.00 ms
   bm_transforms_1000_children (20x) - cpu:  0.01 ms
bm_transforms_1000_children_with_50_grandchildren (20x) - cpu:  2.21 ms
Switched to branch 'transform-cleanup'
Your branch is up to date with 'upstream/transform-cleanup'.
v0.7.0-31-g8ac61c9
    bm_transforms_100_children (20x) - cpu:  0.00 ms
   bm_transforms_1000_children (20x) - cpu:  0.02 ms
bm_transforms_1000_children_with_50_grandchildren (20x) - cpu:  2.14 ms
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
v0.7.0-29-g29ea9a1
    bm_transforms_100_children (20x) - cpu:  0.00 ms
   bm_transforms_1000_children (20x) - cpu:  0.02 ms
bm_transforms_1000_children_with_50_grandchildren (20x) - cpu:  2.15 ms
Switched to branch 'transform-cleanup'
Your branch is up to date with 'upstream/transform-cleanup'.
v0.7.0-31-g8ac61c9
    bm_transforms_100_children (20x) - cpu:  0.00 ms
   bm_transforms_1000_children (20x) - cpu:  0.01 ms
bm_transforms_1000_children_with_50_grandchildren (20x) - cpu:  2.14 ms
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
v0.7.0-29-g29ea9a1
    bm_transforms_100_children (20x) - cpu:  0.00 ms
   bm_transforms_1000_children (20x) - cpu:  0.02 ms
bm_transforms_1000_children_with_50_grandchildren (20x) - cpu:  2.17 ms
Switched to branch 'transform-cleanup'
Your branch is up to date with 'upstream/transform-cleanup'.
v0.7.0-31-g8ac61c9
    bm_transforms_100_children (20x) - cpu:  0.00 ms
   bm_transforms_1000_children (20x) - cpu:  0.02 ms
bm_transforms_1000_children_with_50_grandchildren (20x) - cpu:  2.20 ms
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
v0.7.0-29-g29ea9a1
    bm_transforms_100_children (20x) - cpu:  0.00 ms
   bm_transforms_1000_children (20x) - cpu:  0.01 ms
bm_transforms_1000_children_with_50_grandchildren (20x) - cpu:  2.51 ms
Switched to branch 'transform-cleanup'
Your branch is up to date with 'upstream/transform-cleanup'.
v0.7.0-31-g8ac61c9
    bm_transforms_100_children (20x) - cpu:  0.00 ms
   bm_transforms_1000_children (20x) - cpu:  0.01 ms
bm_transforms_1000_children_with_50_grandchildren (20x) - cpu:  2.00 ms

@Korijn Korijn mentioned this pull request Feb 11, 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.

4 participants