Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add in-place Tree::drop impl #119

Merged
merged 1 commit into from
Apr 5, 2024
Merged

add in-place Tree::drop impl #119

merged 1 commit into from
Apr 5, 2024

Conversation

tjjfvi
Copy link
Contributor

@tjjfvi tjjfvi commented Apr 5, 2024

Closes #118

@tjjfvi tjjfvi force-pushed the drop-tree-in-place branch from 016c428 to d501c52 Compare April 5, 2024 21:52
@tjjfvi tjjfvi requested review from developedby and enricozb April 5, 2024 21:52
@HigherOrderBot
Copy link
Collaborator

Perf run for aac7d9b:

file              mode        main          aac7d9b736ef
========================================================
merge_sort        intr-singl       7.481 s       7.269 s
                  intr-multi       3.937 s       3.696 s
--------------------------------------------------------
boom              intr-singl       2.242 s       2.246 s
                  intr-multi       2.514 s       2.917 s
--------------------------------------------------------
bitonic_sort_lam  intr-singl      11.209 s      11.294 s
                  intr-multi       5.701 s       5.478 s
--------------------------------------------------------
radix_sort_lam    intr-singl       9.550 s       9.659 s
                  intr-multi       4.907 s       4.903 s
--------------------------------------------------------
sum_tree          intr-singl       9.163 s       9.403 s
                  intr-multi       4.359 s       4.476 s
--------------------------------------------------------
c2                intr-singl       0.000 s       0.000 s
                  intr-multi       0.001 s       0.001 s
--------------------------------------------------------
sum_tail          intr-singl       1.140 s       1.134 s
                  intr-multi       1.172 s       1.297 s
--------------------------------------------------------
sum_rec           intr-singl      14.458 s      14.272 s
                  intr-multi       7.393 s       7.432 s

@developedby
Copy link
Member

This is quite clever, did you just think of it or did you reference something

@tjjfvi
Copy link
Contributor Author

tjjfvi commented Apr 5, 2024

I've been aware of the general idea of this approach for a while; I think I first saw it here: https://matklad.github.io/2022/11/18/if-a-tree-falls-in-a-forest-does-it-overflow-the-stack.html, but that only describes implementing it for binary or variable-width trees, not mixed-width trees like here.

(I'd imagine this approach could also be used in hvm-lang.)

@tjjfvi tjjfvi added this pull request to the merge queue Apr 5, 2024
Merged via the queue into main with commit 0530c37 Apr 5, 2024
5 checks passed
@tjjfvi tjjfvi deleted the drop-tree-in-place branch April 5, 2024 22:48
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.

3 participants