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

Make Rc lists clonable without cloning any of its elements. #116

Merged
merged 1 commit into from
Oct 23, 2023

Conversation

01mf02
Copy link
Owner

@01mf02 01mf02 commented Oct 23, 2023

This PR makes reference-counted lists clonable without cloning any of its elements.

Reference-counted lists are used to store the contents of bound variables in jaq.
As they are part of the filter execution context, they are very frequently cloned.
So far, cloning such a list would always clone the head of list, in addition to cloning an Rc-pointer to the tail of the list.
After this change, cloning only clones an Rc-pointer to the list.

The performance implication of this change is quite favourable:

Benchmark n Before After
empty 512 630 650
bf-fib 13 400 380
reverse 1048576 30 30
sort 1048576 100 100
group-by 1048576 440 390
min-max 1048576 180 180
add 1048576 460 420
kv 131072 140 150
kv-update 131072 150 150
kv-entries 131072 590 560
ex-implode 1048576 750 740
reduce 1048576 720 690
try-catch 1048576 150 130
tree-flatten 17 450 420
tree-update 17 280 260
tree-paths 17 1250 1210
to-fromjson 65536 30 30
ack 7 560 520

@01mf02 01mf02 merged commit 58c4067 into main Oct 23, 2023
@01mf02 01mf02 deleted the rc-list-clone branch October 23, 2023 04:43
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