-
Notifications
You must be signed in to change notification settings - Fork 1
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
Dramatically improve performance #5
Comments
Is this still relevant? |
It would definitely be nice to resolve this. However, I don't see myself getting around to it any time soon. PR welcome. :) |
I will add it to my list of fun coding problems to be considered if I have energy :) |
Ok played around with an |
Probably not what you're asking about, but here (for the record) is a benchmark for library(dub)
a <- list(1, list(2, list(3)))
bench::mark(
(x:(y:(z))) %<<-% a,
{x <- a[[1]]; y <- a[[c(2, 1)]]; z <- a[[c(2, 2, 1)]]},
check = FALSE,
iterations = 1e5
)
#> # A tibble: 2 x 13
#> expression min median `itr/sec`
#> <bch:expr> <bch:tm> <bch:tm> <dbl>
#> 1 (x:(y:(z))) %<<-% a 163.4µs 193.1µs 5024.
#> 2 { x <- a[[1]] y <- a[[c(2, 1)]] z <- a[[c(2, 2, 1)]] } 1.16µs 1.29µs 721889.
#> # … with 9 more variables: mem_alloc <bch:byt>, `gc/sec` <dbl>, n_itr <int>, n_gc <dbl>,
#> # total_time <bch:tm>, result <list>, memory <list>, time <list>, gc <list> 😖 It would be nice to get an order of magnitude speedup, in general, thus in this case a reduction to around 10 microseconds. (By the way, zeallot performance is comparably poor, even somewhat worse.) I agree with you: a rewrite in C is probably the only option (if dub is to remain dependency-free). To be frank, I haven't tried profiling |
%<<-%
is fine for interactive use, but currently it is too slow for general use in runtime functions (e.g., package exports). It should be on par with doing multiple standard assignments. This will require the core algorithm—in particular,reify_names()
—to be reimplemented in C.The text was updated successfully, but these errors were encountered: