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

faster Rust programs #12

Merged
merged 2 commits into from
Sep 24, 2023
Merged

faster Rust programs #12

merged 2 commits into from
Sep 24, 2023

Conversation

scottlamb
Copy link
Contributor

No description provided.

@scottlamb
Copy link
Contributor Author

grr, conflicts. rebasing...

* extract processing to `process` function.
  Using `collect()` is nicer anyway, particularly for the Rayon
  version where `ParallelIterator::collect` avoids locking.

* if given a number of seconds, re-run the algorithm for that time.

* build with enough debugging info to make `samply` happy
* for the five 5, use the more efficient bulk heapify op provided
  by `BinaryHeap::from_iter`.

* use a wrapper type that only compares the count. It was doing this
  before when deciding whether to put something into the heap, but not
  within the heap. This is quite verbose but oh well.

* use `peek_mut` rather than `peek` + `pop` + `push`.
@scottlamb
Copy link
Contributor Author

...rebased.

@jinyus
Copy link
Owner

jinyus commented Sep 24, 2023

Thanks for the PR, Time - I/O reduced from 38ms to 23ms.
I will have to create a new folder for this as it's so far from the other implementations. I think I will call it "rust_max"

@jinyus jinyus merged commit d47badc into jinyus:main Sep 24, 2023
@scottlamb scottlamb deleted the faster branch September 25, 2023 15:52
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.

2 participants