You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately, it seems that the expressions are evaluated before the benchmarking begins. (In fairness, the documentation does say that unevaluated expressions are needed.)
After rather a lot of messing around, the best that I could come up with was this.
@richierocks, I know it's been awhile since you first opened this issue under Olaf's account, but I would be interested in your thoughts on Hugh's suggestion.
This was reported as olafmersmann#6.
Suppose I want to test how a function scales with respect to the size of its input.
Here's an example function that scales rather badly.
I can benchmark it as follows
This is pretty clunky though. What I really want to write is something like this:
Unfortunately, it seems that the expressions are evaluated before the benchmarking begins. (In fairness, the documentation does say that unevaluated expressions are needed.)
After rather a lot of messing around, the best that I could come up with was this.
This works, but it is pretty ugly, and was hard to find.
It would be useful if you could have a think about ways to make it easier to use the
list
argument to microbenchmark.If you have a simpler way to use it, please add an example to
example(microbenchmark)
(or possibly even to a vignette).Using some sort of lazy evaluation of the list elements so that
lapply(n, f)
works would be even better.The text was updated successfully, but these errors were encountered: