Skip to content

Fix/faster direction group#133

Merged
robitalec merged 6 commits intomainfrom
fix/faster-direction-group
Dec 16, 2025
Merged

Fix/faster direction group#133
robitalec merged 6 commits intomainfrom
fix/faster-direction-group

Conversation

@robitalec
Copy link
Copy Markdown
Member

Improve speed of direction_group

  • use as.numeric instead of drop_units
  • replace unit outside of by=
  • use env= instead of .SDcols (circ.mean spent more time on Math.data.frame etc than if passed a col directly with env=)
> bench::mark(
+ 	old = direction_group_old(DT),
+ 	new = direction_group(DT),
+ 	relative = TRUE
+ )
# A tibble: 2 × 13
  expression   min median `itr/sec` mem_alloc `gc/sec` n_itr  n_gc total_time result memory     time       gc      
  <bch:expr> <dbl>  <dbl>     <dbl>     <dbl>    <dbl> <int> <dbl>   <bch:tm> <list> <list>     <list>     <list>  
1 old         213.   155.        1       795.     1        1    22      3.86s <dt>   <Rprofmem> <bench_tm> <tibble>
2 new           1      1       144.        1      1.03    19     3   510.83ms <dt>   <Rprofmem> <bench_tm> <tibble>

@robitalec robitalec self-assigned this Dec 16, 2025
@robitalec robitalec added the type: enhancement new features, improvements label Dec 16, 2025
@robitalec robitalec merged commit c971dbb into main Dec 16, 2025
1 of 6 checks passed
@robitalec robitalec deleted the fix/faster-direction-group branch December 16, 2025 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement new features, improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant