-
Notifications
You must be signed in to change notification settings - Fork 25
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
Optimize and benchmark circular references #48
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
CI is failing, couyld you fix? |
I don't think it has anything to do with my changes. I get the same error on master when I run
|
When I run it locally, |
please rebase, I've removed codecov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still lgtm
for some odd reasons this is crashing on node v22. Can you take a look? |
This also fails on master. It looks like an internal node assert. Perhaps the test dependencies don't support Node 22? When I upgrade tap from 12 to 18+, Node no longer asserts, but the tests fail with messages like "isNot is not a function". |
I added a test for cloning circular references, and it performed very poorly:
I figured the performance was likely due to using
Array.indexOf()
to handle looking up circular references. I used aMap
instead, and the performance improved dramatically:On the original benchmark (no circular references), there is only a slight degradation on performance when using
circles: true
. Here's the original code:And the code from this branch:
Overall, still very competitive, and no longer unusable when many cycles are encountered.