From 5497a775dbe039b2d11b1dd828d6ecac9343eb4c Mon Sep 17 00:00:00 2001 From: chainsawriot Date: Fri, 8 Nov 2024 11:46:35 +0100 Subject: [PATCH] Remove non-API calls (#36) * Update cpp11 * Remove non-API calls * Update benchmark --- DESCRIPTION | 2 +- misc/benchmark.md | 14 +++++++------- src/Collector.h | 10 ---------- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 955eda9..cc1aa66 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -18,7 +18,7 @@ BugReports: https://github.com/gesistsa/minty/issues Depends: R (>= 3.6) LinkingTo: - cpp11, + cpp11 (>= 0.5.0), tzdb (>= 0.1.1) Config/testthat/edition: 3 Config/testthat/parallel: false diff --git a/misc/benchmark.md b/misc/benchmark.md index cae05ec..0c67775 100644 --- a/misc/benchmark.md +++ b/misc/benchmark.md @@ -7,7 +7,7 @@ suppressPackageStartupMessages(library(readr)) Sys.time() ``` - [1] "2024-11-08 10:42:18 CET" + [1] "2024-11-08 11:32:50 CET" Under 200 rows, simple @@ -21,8 +21,8 @@ bench::mark(minty::type_convert(iris_chr), # A tibble: 2 × 6 expression min median `itr/sec` mem_alloc `gc/sec` - 1 minty::type_convert(iris_chr) 419.37µs 464.8µs 2105. 702.53KB 0 - 2 suppressMessages(readr::type_c… 2.24ms 2.26ms 357. 1.97MB 0 + 1 minty::type_convert(iris_chr) 417.2µs 483.39µs 2020. 702.53KB 0 + 2 suppressMessages(readr::type_c… 2.23ms 2.34ms 345. 1.97MB 0 Many rows @@ -39,8 +39,8 @@ bench::mark(minty::type_convert(flights_chr, guess_integer = TRUE), # A tibble: 2 × 6 expression min median `itr/sec` mem_alloc `gc/sec` - 1 minty::type_convert(flights_chr, gu… 1.15s 1.19s 0.840 189MB 15.4 - 2 suppressMessages(readr::type_conver… 1.05s 1.06s 0.924 153MB 17.0 + 1 minty::type_convert(flights_chr, gu… 1.14s 1.19s 0.842 189MB 15.5 + 2 suppressMessages(readr::type_conver… 1.06s 1.06s 0.918 153MB 16.9 Many row, guess_max @@ -56,8 +56,8 @@ bench::mark(minty::type_convert(flights_chr, guess_integer = TRUE, guess_max = 5 # A tibble: 2 × 6 expression min median `itr/sec` mem_alloc `gc/sec` - 1 minty::type_convert(flights_ch… 574.35ms 581.84ms 1.67 153MB 18.4 - 2 suppressMessages(readr::type_c… 1.06s 1.11s 0.916 153MB 16.7 + 1 minty::type_convert(flights_ch… 552.31ms 559.35ms 1.73 153MB 19.0 + 2 suppressMessages(readr::type_c… 1.07s 1.12s 0.909 153MB 16.5 ``` r sessionInfo() diff --git a/src/Collector.h b/src/Collector.h index 897c867..2760194 100644 --- a/src/Collector.h +++ b/src/Collector.h @@ -48,17 +48,7 @@ class Collector { if (column_ == R_NilValue) return; -#if R_VERSION >= R_Version(3, 4, 0) - if (n > 0 && n < n_) { - SET_TRUELENGTH(column_, n_); - SETLENGTH(column_, n); - SET_GROWABLE_BIT(column_); - } else { - column_ = Rf_lengthgets(column_, n); - } -#else column_ = Rf_lengthgets(column_, n); -#endif n_ = n; }