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
compare()
is really slow for sfc objects
#86
Comments
More minimal reprex: objs <- lapply(1:1000, function(x) as.raw(1:100))
objs_copy <- lapply(1:1000, function(x) as.raw(1:100))
waldo::compare(objs_copy, objs)
#> ✓ No differences
all.equal(objs_copy, objs)
#> [1] TRUE
identical(objs_copy, objs)
#> [1] TRUE
bench::mark(
waldo::compare(objs_copy, objs),
all.equal(objs_copy, objs),
identical(objs_copy, objs),
check = FALSE
)
#> Warning: Some expressions had a GC in every iteration; so filtering is disabled.
#> # A tibble: 3 x 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 waldo::compare(objs_copy, objs) 2.75s 2.75s 0.364 17.76MB 9.10
#> 2 all.equal(objs_copy, objs) 14.94ms 16.46ms 51.2 2.56MB 13.8
#> 3 identical(objs_copy, objs) 23.05µs 24.17µs 38961. 0B 0 Created on 2021-07-11 by the reprex package (v0.3.0) |
Even more minimal reprex 😄 x <- as.raw(sample(100, 1000, replace = TRUE))
x2 <- c(x)
bench::mark(
waldo::compare(x, x2),
all.equal(x, x2),
identical(x, x2),
check = FALSE
)
#> # A tibble: 3 x 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 waldo::compare(x, x2) 1.94ms 2.47ms 408. 14MB 14.9
#> 2 all.equal(x, x2) 16µs 22.52µs 40595. 110KB 20.3
#> 3 identical(x, x2) 1.01µs 1.44µs 668548. 0B 0 Created on 2021-07-11 by the reprex package (v2.0.0) |
hadley
added a commit
that referenced
this issue
Jul 11, 2021
hadley
added a commit
that referenced
this issue
Jul 12, 2021
Thank you! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In migrating wk to use testthat 3e I noticed that the time it took to run
devtools::test()
went from ~4 seconds to about a minute. I'm not sure if this is an issue worth fixing (the better diffs when something is off are more than worth it!), but there are some pairs of objects that take a confusingly long time to compare even when there are no differences (as reported bycompare()
,all.equal()
, andidentical()
).Created on 2021-07-11 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: