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

Slow when first element in `||` compound exp fails #64

Closed
brodieG opened this issue Aug 17, 2017 · 1 comment
Closed

Slow when first element in `||` compound exp fails #64

brodieG opened this issue Aug 17, 2017 · 1 comment
Labels
Milestone

Comments

@brodieG
Copy link
Owner

@brodieG brodieG commented Aug 17, 2017

vetr.sqr.num.mx <- quote(matrix(numeric(), 0) && ncol(.) == nrow(.))
vetr.sqr.num.mx.or.sclr.num <- quote(vetr.sqr.num.mx || numeric(1L))
vetr.sclr.num.or.sqr.num.mx <- quote(numeric(1L) || vetr.sqr.num.mx)

microbenchmark::microbenchmark(
  vet(vetr.sqr.num.mx.or.sclr.num, 1),
  vet(vetr.sclr.num.or.sqr.num.mx, 1)
)
Unit: microseconds
                                expr    min      lq     mean  median      uq
 vet(vetr.sqr.num.mx.or.sclr.num, 1) 38.854 42.5640 55.87488 44.4305 53.0145
 vet(vetr.sclr.num.or.sqr.num.mx, 1) 10.176 11.7585 15.52204 13.5075 14.5170
     max neval
 199.207   100
  72.581   100
@brodieG brodieG added the bug label Aug 17, 2017
@brodieG brodieG added this to the 0.1.1 milestone Aug 17, 2017
@brodieG
Copy link
Owner Author

@brodieG brodieG commented Aug 20, 2017

Seems like unfortunately a lot of the overhead is just the failing alike call:

> microbenchmark(alike(numeric(), NULL))
Unit: microseconds
                   expr    min     lq    mean median      uq     max neval
 alike(numeric(), NULL) 27.659 28.383 30.9083 28.725 29.2745 161.006   100

So really, we need to optimize that.

After we skip the ALIKEC_pad_or_quote bit:

Unit: microseconds
                   expr    min     lq     mean  median     uq     max neval
 alike(numeric(), NULL) 17.028 17.471 19.24952 17.6855 17.916 157.746   100

For reference, passing:

> microbenchmark(alike(numeric(), 1))
Unit: microseconds
                expr   min    lq    mean median     uq    max neval
 alike(numeric(), 1) 2.128 2.222 2.63623 2.2925 2.3835 32.608   100

Completely skipping all the stuff in _wrap after !success, still getting:

> microbenchmark(alike(numeric(), NULL))
Unit: microseconds
                   expr    min      lq     mean median      uq    max neval
 alike(numeric(), NULL) 15.456 15.9885 17.11938 16.211 16.6025 76.616   100
@brodieG brodieG added the fixed in dev label Sep 3, 2017
@brodieG brodieG closed this in 150e514 Sep 17, 2017
brodieG added a commit that referenced this issue Sep 17, 2017
Fix #81, Fix #77, Fix #76, Fix #73, Fix #70,
Fix #69, Fix #65, Fix #64, Fix #61, Fix #59
Fix #56, Fix #51, Fix #48, Fix #47, Fix #46,
Fix #45, Fix #43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.