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

performance tests #2

Open
pearsonca opened this issue Jul 16, 2023 · 3 comments
Open

performance tests #2

pearsonca opened this issue Jul 16, 2023 · 3 comments

Comments

@pearsonca
Copy link
Collaborator

Worthwhile to add some benchmarking stuff?

@pearsonca
Copy link
Collaborator Author

Screenshot from 2023-08-01 17-31-56

Overall, adding HBM is ~ an order of magnitude increase in run time - that's way above theoretical expense. I'd like to get it to sub-order of magnitude multiplier (so < 5x) for the draws component. Simulations will vary in how much of their computational component is RNG, so in general the actual multiplier will be less than that due to RNG-only, but ~10x is still too high.

As shown in screenshot above, a few things that are a bit hot. We can do better on the hashing step (switching to a faster hashing algo should trim that portion 2-3x), but that won't speed up converting things to raw array to feed.

Any ideas on how to approach that latter problem?

We could do something like restrict ... inputs to integers only, then eliminate the writeBin step. I'd prefer to keep the user-side flexibility of using whatever, but might have to sacrifice that if we can't finding a sufficiently performant way to offer it.

@seabbs
Copy link
Collaborator

seabbs commented Aug 1, 2023

Unless I am missing something the Reduce call is a slow choice vs other options.

iterations <- 1e3
within_its <- 1e3

system.time({
  Reduce(c, lapply(1:iterations, function(i) {1:within_its}))
})

system.time({
  unlist(lapply(1:iterations, function(i) {1:within_its}))
})

system.time({
  sapply(1:iterations, function(i) {1:within_its})
})

@seabbs
Copy link
Collaborator

seabbs commented Aug 1, 2023

Also worth checking out bit64?

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

No branches or pull requests

2 participants