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

Don't allocate z or m members of an xy unless they're needed #154

Merged
merged 3 commits into from
Sep 22, 2022

Conversation

paleolimbot
Copy link
Owner

Fixes #131.

Before:

library(wk)

many_points <- as_wkb(xy(runif(1e6), runif(1e6)))
bench::mark(as_xy(many_points))
#> # A tibble: 1 × 6
#>   expression              min   median `itr/sec` mem_alloc `gc/sec`
#>   <bch:expr>         <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl>
#> 1 as_xy(many_points)     67ms   67.3ms      14.9    30.6MB     37.2

Created on 2022-09-21 by the reprex package (v2.0.1)

After:

library(wk)

many_points <- as_wkb(xy(runif(1e6), runif(1e6)))
bench::mark(as_xy(many_points))
#> # A tibble: 1 × 6
#>   expression              min   median `itr/sec` mem_alloc `gc/sec`
#>   <bch:expr>         <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl>
#> 1 as_xy(many_points)   24.6ms   25.1ms      39.8    15.3MB     62.5

Created on 2022-09-21 by the reprex package (v2.0.1)

@codecov-commenter
Copy link

Codecov Report

Base: 98.95% // Head: 98.92% // Decreases project coverage by -0.03% ⚠️

Coverage data is based on head (7deaaa8) compared to base (d43c2c2).
Patch coverage: 94.87% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #154      +/-   ##
==========================================
- Coverage   98.95%   98.92%   -0.04%     
==========================================
  Files          74       74              
  Lines        5173     5198      +25     
==========================================
+ Hits         5119     5142      +23     
- Misses         54       56       +2     
Impacted Files Coverage Δ
src/xy-writer.c 98.90% <94.87%> (-1.10%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@paleolimbot paleolimbot merged commit 93d9362 into master Sep 22, 2022
@paleolimbot paleolimbot deleted the xy-writer branch September 22, 2022 02:17
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

Successfully merging this pull request may close these issues.

xy_writer() allocates more than it should
2 participants