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

BenchmarkJsArrayQuickSort10000 doesn't finish when running all benchmarks #378

Open
jclc opened this issue Jun 10, 2020 · 3 comments · Fixed by #459
Open

BenchmarkJsArrayQuickSort10000 doesn't finish when running all benchmarks #378

jclc opened this issue Jun 10, 2020 · 3 comments · Fixed by #459

Comments

@jclc
Copy link

jclc commented Jun 10, 2020

Attempting to run all benchmarks with go test -bench . in the root folder stops at BenchmarkJsArrayQuickSort10000, when the benchmark will run forever without finishing. Memory usage jumps up to 1.3GB and CPU usage to 100% on one core.

@jclc
Copy link
Author

jclc commented Jun 10, 2020

Trying the benchmark with smaller arrays seems to work, it just takes insanely long. Far longer than is normal for quick sort.

stevenh added a commit that referenced this issue Nov 27, 2022
Reduce the item count in JavaScript sort benchmarks to something more
reasonable given the memory pressure they cause.

Fixes #378
@stevenh
Copy link
Collaborator

stevenh commented Nov 27, 2022

The cause of this is shear number of allocation requests due to the why lots of temporary structs that are created when running the JS sort code.

When running this code with just 500 items it allocates 19GB.

I have a some work in progress code which uses sync.Pool to create caches that can be reused, but it's not a simple task with the current design, potentially resulting in more fragile code.

In the mean time I've reduced the count from 10k to 500 which results in a reasonable time to run.

stevenh added a commit that referenced this issue Nov 27, 2022
Reduce the item count in JavaScript sort benchmarks to something more
reasonable given the memory pressure they cause.

Fixes #378
@stevenh stevenh reopened this Nov 27, 2022
@stevenh
Copy link
Collaborator

stevenh commented Nov 27, 2022

Keeping this open to track progress on improving memory usage.

sg3des pushed a commit to sg3des/otto that referenced this issue Jul 17, 2023
Reduce the item count in JavaScript sort benchmarks to something more
reasonable given the memory pressure they cause.

Fixes robertkrimen#378
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants