Speed Comparisons

A few notes:

• Comparing times from separate functions won’t be very useful. For example - the summarize() tests were performed on a different dataset from case_when().
• setDTthreads(4) was used for data.table & tidytable timings.
• Modify-by-reference was used in data.table when being compared to mutate.() & dplyr::mutate()
• fill.() & tidyr::fill() both work with character/factor/logical columns, whereas data.table::nafill() does not. Testing only included numeric columns due to this constraint.
• dtplyr is missing timings for functions that are not yet implemented in the package.
• pandas comparisons are in the process of being added - more will be added soon.
• All tests are run 11 times. The times shown are the median of those 11 runs.
• All timings are in milliseconds.
• All tests can be found in the source code here.
• FAQ - Why are some tidytable functions faster than their data.table counterpart?
• Short answer - they’re not! After all they’re just using data.table in the background.
• Long answer - All R functions have some slight natural variation in their execution time. By chance the tidytable runs were slightly shorter on those specific functions on this iteration of the tests. However one goal of these tests is to show that the “time cost” of translating tidyverse syntax to data.table is very negligible to the user (especially on medium-to-large datasets).
• Lastly I’d like to mention that these tests were not rigorously created to cover all angles equally. They are just meant to be used as general insight into the performance of these packages.
#> Date last run: 2023-01-13
#> # A tidytable: 13 × 6
#>    func_tested  data.table tidytable dtplyr tidyverse pandas
#>    <chr>             <dbl>     <dbl>  <dbl>     <dbl>  <dbl>
#>  1 arrange            48.2      32.4   62.5      89    716.
#>  2 case_when           9.3       9.8   NA        56.6   64.4
#>  3 distinct           24.1      24.4   28.3      66.9  309.
#>  4 fill               38        63.6   54.5      85.6  724
#>  5 filter            181.      190.   192.      319.   904.
#>  6 inner_join         36.2      42.5   62        96.4   NA
#>  7 left_join          59.8      58.7   72.2     230.    NA
#>  8 mutate             61.8      63.6  187.       80.2  780.
#>  9 nest               18        19.8   92.2      60.4   NA
#> 10 pivot_longer       61.7      36.3   64.4     237.    NA
#> 11 pivot_wider        58.7      65.6  157.      128.    NA
#> 12 summarize         375.      345.   362.      865.  3080.
#> 13 unnest            275.       75.5   NA        85.2   NA