Skip to content

Commit 73d58e1

Browse files
committed
Add Vendor experiment
1 parent 60a1bcd commit 73d58e1

31 files changed

+4035
-20
lines changed

DESCRIPTION

+1-3
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ Imports:
3131
vctrs (>= 0.4.2),
3232
zip,
3333
tools
34-
LinkingTo:
35-
cpp11 (>= 0.4.6)
3634
Suggests:
3735
spelling,
3836
testthat,
@@ -43,7 +41,7 @@ Suggests:
4341
withr,
4442
readr (>= 1.2.1)
4543
License: GPL-3
46-
RoxygenNote: 7.2.3
44+
RoxygenNote: 7.3.1
4745
Roxygen: list(markdown = TRUE)
4846
Encoding: UTF-8
4947
VignetteBuilder: knitr

benchmark/issue81_template.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
date()
66
```
77

8-
[1] "Thu May 23 09:29:23 2024"
8+
[1] "Sun May 26 01:39:17 2024"
99

1010
``` r
1111
devtools::load_all()
@@ -19,7 +19,7 @@ system.time(x <- read_ods(file, sheet = 2, skip = 4))
1919
```
2020

2121
user system elapsed
22-
0.375 0.072 0.446
22+
0.424 0.032 0.465
2323

2424
``` r
2525
dim(x)

benchmark/roundtrip.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ Let’s break it down
1616
date()
1717
```
1818

19-
[1] "Thu May 23 09:28:23 2024"
19+
[1] "Sun May 26 01:38:17 2024"
2020

2121
``` r
2222
library(nycflights13)
2323
system.time(path <- writexl::write_xlsx(flights))
2424
```
2525

2626
user system elapsed
27-
6.156 0.296 6.460
27+
6.096 0.264 6.377
2828

2929
``` r
3030
system.time(out <- readxl::read_xlsx(path))
3131
```
3232

3333
user system elapsed
34-
2.168 0.625 2.800
34+
2.190 0.775 2.987
3535

3636
``` r
3737
all.equal(out, flights)
@@ -52,14 +52,14 @@ system.time(path <- readODS::write_ods(flights))
5252
```
5353

5454
user system elapsed
55-
13.493 0.360 13.912
55+
13.252 0.496 13.902
5656

5757
``` r
5858
system.time(out <- readODS::read_ods(path))
5959
```
6060

6161
user system elapsed
62-
27.568 1.740 29.362
62+
27.045 2.042 29.205
6363

6464
``` r
6565
all.equal(out, flights)

benchmark/tidyodsexample.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
date()
66
```
77

8-
[1] "Thu May 23 09:29:18 2024"
8+
[1] "Sun May 26 01:39:12 2024"
99

1010
``` r
1111
devtools::load_all()
@@ -23,7 +23,7 @@ bench::mark("readODS" = read_ods(file, sheet = 2), check = FALSE, filter_gc = FA
2323
# A tibble: 1 × 4
2424
expression min median mean
2525
<bch:expr> <bch:tm> <bch:tm> <bch:tm>
26-
1 readODS 5.01ms 5.29ms 7.83ms
26+
1 readODS 5.12ms 5.29ms 7.59ms
2727

2828
``` r
2929
postcodes_file <- here::here("benchmark/civil-service-postcodes-2021.ods")
@@ -52,4 +52,4 @@ bench::mark("readODS" = readODS::read_ods(postcodes_file, 2), check = FALSE, fil
5252
# A tibble: 1 × 4
5353
expression min median mean
5454
<bch:expr> <bch:tm> <bch:tm> <bch:tm>
55-
1 readODS 425ms 444ms 445ms
55+
1 readODS 420ms 429ms 435ms

benchmark/write_ods.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
date()
66
```
77

8-
[1] "Thu May 23 09:29:28 2024"
8+
[1] "Sun May 26 01:39:22 2024"
99

1010
``` r
1111
devtools::load_all()
@@ -28,7 +28,7 @@ system.time(write_ods(df1, path = tempfile(fileext = ".ods")))
2828
```
2929

3030
user system elapsed
31-
0.043 0.004 0.062
31+
0.046 0.000 0.052
3232

3333
Large df
3434

@@ -37,7 +37,7 @@ system.time(write_ods(nycflights13::flights))
3737
```
3838

3939
user system elapsed
40-
14.517 0.484 15.222
40+
14.158 0.556 14.893
4141

4242
``` r
4343
sessionInfo()

benchmark/write_ods_apend.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
date()
66
```
77

8-
[1] "Thu May 23 09:29:25 2024"
8+
[1] "Sun May 26 01:39:19 2024"
99

1010
``` r
1111
devtools::load_all()
@@ -30,21 +30,21 @@ system.time(write_ods(df1, path = path, sheet = "aaaa", append = TRUE))
3030
```
3131

3232
user system elapsed
33-
0.254 0.020 0.290
33+
0.249 0.025 0.280
3434

3535
``` r
3636
system.time(write_ods(df1, path = path, sheet = "aaaa", update = TRUE))
3737
```
3838

3939
user system elapsed
40-
0.332 0.020 0.367
40+
0.313 0.035 0.357
4141

4242
``` r
4343
system.time(write_ods(mtcars, path = path, sheet = "aaaa", update = TRUE))
4444
```
4545

4646
user system elapsed
47-
0.225 0.012 0.249
47+
0.211 0.028 0.246
4848

4949
``` r
5050
sessionInfo()

inst/include/cpp11.hpp

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// cpp11 version: 0.4.7
2+
// vendored on: 2024-05-26
3+
#pragma once
4+
5+
#include "cpp11/R.hpp"
6+
#include "cpp11/altrep.hpp"
7+
#include "cpp11/as.hpp"
8+
#include "cpp11/attribute_proxy.hpp"
9+
#include "cpp11/data_frame.hpp"
10+
#include "cpp11/doubles.hpp"
11+
#include "cpp11/environment.hpp"
12+
#include "cpp11/external_pointer.hpp"
13+
#include "cpp11/function.hpp"
14+
#include "cpp11/integers.hpp"
15+
#include "cpp11/list.hpp"
16+
#include "cpp11/list_of.hpp"
17+
#include "cpp11/logicals.hpp"
18+
#include "cpp11/matrix.hpp"
19+
#include "cpp11/named_arg.hpp"
20+
#include "cpp11/protect.hpp"
21+
#include "cpp11/r_bool.hpp"
22+
#include "cpp11/r_string.hpp"
23+
#include "cpp11/r_vector.hpp"
24+
#include "cpp11/raws.hpp"
25+
#include "cpp11/sexp.hpp"
26+
#include "cpp11/strings.hpp"

inst/include/cpp11/R.hpp

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// cpp11 version: 0.4.7
2+
// vendored on: 2024-05-26
3+
#pragma once
4+
5+
#ifdef R_INTERNALS_H_
6+
#if !(defined(R_NO_REMAP) && defined(STRICT_R_HEADERS))
7+
#error R headers were included before cpp11 headers \
8+
and at least one of R_NO_REMAP or STRICT_R_HEADERS \
9+
was not defined.
10+
#endif
11+
#endif
12+
13+
#define R_NO_REMAP
14+
#define STRICT_R_HEADERS
15+
#include "Rinternals.h"
16+
17+
// clang-format off
18+
#ifdef __clang__
19+
# pragma clang diagnostic push
20+
# pragma clang diagnostic ignored "-Wattributes"
21+
#endif
22+
23+
#ifdef __GNUC__
24+
# pragma GCC diagnostic push
25+
# pragma GCC diagnostic ignored "-Wattributes"
26+
#endif
27+
// clang-format on
28+
29+
#include <type_traits>
30+
#include "cpp11/altrep.hpp"
31+
32+
namespace cpp11 {
33+
namespace literals {
34+
35+
constexpr R_xlen_t operator"" _xl(unsigned long long int value) { return value; }
36+
37+
} // namespace literals
38+
39+
namespace traits {
40+
template <typename T>
41+
struct get_underlying_type {
42+
using type = T;
43+
};
44+
} // namespace traits
45+
46+
template <typename T>
47+
inline T na();
48+
49+
template <typename T>
50+
inline typename std::enable_if<!std::is_same<typename std::decay<T>::type, double>::value,
51+
bool>::type
52+
is_na(const T& value) {
53+
return value == na<T>();
54+
}
55+
56+
template <typename T>
57+
inline typename std::enable_if<std::is_same<typename std::decay<T>::type, double>::value,
58+
bool>::type
59+
is_na(const T& value) {
60+
return ISNA(value);
61+
}
62+
63+
} // namespace cpp11

inst/include/cpp11/altrep.hpp

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// cpp11 version: 0.4.7
2+
// vendored on: 2024-05-26
3+
#pragma once
4+
5+
#include "Rversion.h"
6+
7+
#if defined(R_VERSION) && R_VERSION >= R_Version(3, 5, 0)
8+
#define HAS_ALTREP
9+
#endif
10+
11+
#ifndef HAS_ALTREP
12+
13+
#define ALTREP(x) false
14+
15+
#define REAL_ELT(x, i) REAL(x)[i]
16+
#define INTEGER_ELT(x, i) INTEGER(x)[i]
17+
#define LOGICAL_ELT(x, i) LOGICAL(x)[i]
18+
#define RAW_ELT(x, i) RAW(x)[i]
19+
20+
#define SET_REAL_ELT(x, i, val) REAL(x)[i] = val
21+
#define SET_INTEGER_ELT(x, i, val) INTEGER(x)[i] = val
22+
#define SET_LOGICAL_ELT(x, i, val) LOGICAL(x)[i] = val
23+
#define SET_RAW_ELT(x, i, val) RAW(x)[i] = val
24+
25+
#define REAL_GET_REGION(...) \
26+
do { \
27+
} while (false)
28+
29+
#define INTEGER_GET_REGION(...) \
30+
do { \
31+
} while (false)
32+
#endif
33+
34+
#if !defined HAS_ALTREP || (defined(R_VERSION) && R_VERSION < R_Version(3, 6, 0))
35+
36+
#define LOGICAL_GET_REGION(...) \
37+
do { \
38+
} while (false)
39+
40+
#define RAW_GET_REGION(...) \
41+
do { \
42+
} while (false)
43+
44+
#endif

0 commit comments

Comments
 (0)