Skip to content
Merged

Dev #28

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ README.html
^revdep$
^inst/analysis
^inst/standalone
^context
11 changes: 8 additions & 3 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
# usethis::use_github_action("check-standard") will install it.
on:
push:
branches: [main, master]
branches: [main, master, dev]
pull_request:
branches: [main, master]
branches: [main, master, dev]

name: R-CMD-check

permissions:
contents: read

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
Expand Down Expand Up @@ -42,7 +45,9 @@ jobs:
- name: Windows CRLF fix
run: git config --global core.autocrlf false

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: r-lib/actions/setup-pandoc@v2

Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/rhub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ on:
env:
QS_EXTENDED_TESTS: true

permissions:
contents: read

jobs:

setup:
Expand Down Expand Up @@ -54,6 +57,8 @@ jobs:

steps:
- uses: r-hub/actions/checkout@v1
with:
submodules: recursive
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
Expand All @@ -79,6 +84,8 @@ jobs:

steps:
- uses: r-hub/actions/checkout@v1
with:
submodules: recursive
- uses: r-hub/actions/setup-r@v1
with:
job-config: ${{ matrix.config.job-config }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ configure~
*.gz
*.json
context
context/*
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "inst/include/qdata-cpp"]
path = inst/include/qdata-cpp
url = https://github.com/qsbase/qdata-cpp.git
branch=main
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: qs2
Type: Package
Title: Efficient Serialization of R Objects
Version: 0.1.8
Date: 2026-03-03
Version: 0.1.9
Date: 2026-03-24
Authors@R: c(
person("Travers", "Ching", email = "traversc@gmail.com", role = c("aut", "cre", "cph")),
person("Yann", "Collet", role = c("ctb", "cph"), comment = "Yann Collet is the author of the bundled zstd"),
Expand All @@ -21,7 +21,7 @@ Imports:
Rcpp, stringfish (>= 0.18.0)
LinkingTo: Rcpp, stringfish, RcppParallel
Suggests: knitr, rmarkdown, dplyr, data.table, stringi
SystemRequirements: GNU make
SystemRequirements: GNU make, C++17
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.3
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ PACKAGE := $(shell perl -aF: -ne 'print, exit if s/^Package:\s+//' DESCRIPTION)
VERSION := $(shell perl -aF: -ne 'print, exit if s/^Version:\s+//' DESCRIPTION)
BUILD := $(PACKAGE)_$(VERSION).tar.gz

.PHONY: doc build install test vignette $(BUILD)
.PHONY: doc build install test vignette submodules $(BUILD)

submodules:
git submodule sync --recursive
git submodule update --remote --init --recursive --force

check: $(BUILD)
R CMD check --as-cran $<
Expand Down
55 changes: 31 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,27 +194,34 @@ using namespace Rcpp;

// [[Rcpp::export]]
SEXP test_qs_serialize(SEXP x) {
size_t len = 0;
unsigned char * buffer = c_qs_serialize(x, &len, 10, true, 4); // object, buffer length, compress_level, shuffle, nthreads
SEXP y = c_qs_deserialize(buffer, len, false, 4); // buffer, buffer length, validate_checksum, nthreads
c_qs_free(buffer); // must manually free buffer
return y;
SEXP buffer = qs_serialize(x, 10, true, 4);
return qs_deserialize(buffer, false, 4);
}

// [[Rcpp::export]]
SEXP test_qd_serialize(SEXP x) {
size_t len = 0;
unsigned char * buffer = c_qd_serialize(x, &len, 10, true, 4); // object, buffer length, compress_level, shuffle, nthreads
SEXP y = c_qd_deserialize(buffer, len, false, false, 4); // buffer, buffer length, use_alt_rep, validate_checksum, nthreads
c_qd_free(buffer); // must manually free buffer
return y;
SEXP buffer = qd_serialize(x, 10, true, true, 4);
return qd_deserialize(buffer, false, false, 4);
}

// [[Rcpp::export]]
SEXP test_qs_save(SEXP x, const std::string& path) {
qs_save(x, path, 10, true, 4);
return qs_read(path, false, 4);
}

// [[Rcpp::export]]
SEXP test_qd_save(SEXP x, const std::string& path) {
qd_save(x, path, 10, true, true, 4);
return qd_read(path, false, false, 4);
}

/*** R
x <- runif(1e7)
stopifnot(test_qs_serialize(x) == x)
stopifnot(test_qd_serialize(x) == x)
stopifnot(identical(test_qs_serialize(x), x))
stopifnot(identical(test_qd_serialize(x), x))
stopifnot(identical(test_qs_save(x, tempfile(fileext = ".qs2")), x))
stopifnot(identical(test_qd_save(x, tempfile(fileext = ".qd")), x))
*/
```

Expand All @@ -224,32 +231,32 @@ The following global options control the behavior of the `qs2`
functions. These global options can be queried or modified using `qopt`
function.

- **compress_level**
The default compression level used when compressing data.
- **compress_level**\
The default compression level used when compressing data.\
**Default:** `3L`

- **shuffle**
- **shuffle**\
A logical flag indicating whether to allow byte shuffling during
compression.
compression.\
**Default:** `TRUE`

- **nthreads**
The number of threads used for compression and decompression.
- **nthreads**\
The number of threads used for compression and decompression.\
**Default:** `1L`

- **validate_checksum**
- **validate_checksum**\
A logical flag indicating whether to validate the stored checksum when
reading data.
reading data.\
**Default:** `FALSE`

- **warn_unsupported_types**
- **warn_unsupported_types**\
For `qd_save`, a logical flag indicating whether to warn when saving
an object with unsupported types.
an object with unsupported types.\
**Default:** `TRUE`

- **use_alt_rep**
- **use_alt_rep**\
For `qd_read`, a logical flag indicating whether to use ALTREP when
reading in string data.
reading in string data.\
**Default:** `FALSE`

------------------------------------------------------------------------
15 changes: 14 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ PACKAGE_URL=''

ac_subst_vars='LTLIBOBJS
LIBOBJS
CXX_STD_LINE
SIMD_FLAG
TBB_FLAG
DYNAMIC_BLOCKSIZE_FLAG
Expand Down Expand Up @@ -2779,6 +2780,16 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu

echo "C++ compiler: $PATH_TO_CPP_COMPILER"

R_VERSION_STRING=`"${R_HOME}/bin/Rscript" -e "cat(as.character(getRversion()))"`
R_NEEDS_EXPLICIT_CXX17=`"${R_HOME}/bin/Rscript" -e "cat(as.integer(getRversion() < '4.3.0'))"`
if test "x$R_NEEDS_EXPLICIT_CXX17" = "x1"; then
echo "R ${R_VERSION_STRING} detected -- explicitly requesting C++17"
CXX_STD_LINE="CXX_STD = CXX17"
else
echo "R ${R_VERSION_STRING} detected -- using R default C++ standard"
CXX_STD_LINE="# CXX17 is the default for R >= 4.3.0"
fi

########################################################
### Configure args

Expand Down Expand Up @@ -2872,7 +2883,7 @@ elif test "xx$PKGCONF" != "xx"; then
ZSTD_INCLUDE_PATH=`"${PKGCONF}" --cflags-only-I libzstd`
COMPILE_ZSTD="false"
else
echo "zstd ${VERSION_STRING} library detected but is lower than bundled version (1.5.2) -- compiling from source"
echo "zstd ${VERSION_STRING} library detected but is lower than bundled version (1.5.6) -- compiling from source"
COMPILE_ZSTD="true"
fi
else
Expand Down Expand Up @@ -3028,6 +3039,8 @@ TBB_FLAG=$TBB_FLAG

SIMD_FLAG=$SIMD_FLAG

CXX_STD_LINE=$CXX_STD_LINE


ac_config_files="$ac_config_files src/Makevars"

Expand Down
13 changes: 12 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ PATH_TO_CPP_COMPILER=`"${R_HOME}/bin/R" CMD config CXX`
AC_PROG_CXX([$PATH_TO_CPP_COMPILER])
echo "C++ compiler: $PATH_TO_CPP_COMPILER"

R_VERSION_STRING=`"${R_HOME}/bin/Rscript" -e "cat(as.character(getRversion()))"`
R_NEEDS_EXPLICIT_CXX17=`"${R_HOME}/bin/Rscript" -e "cat(as.integer(getRversion() < '4.3.0'))"`
if test "x$R_NEEDS_EXPLICIT_CXX17" = "x1"; then
echo "R ${R_VERSION_STRING} detected -- explicitly requesting C++17"
CXX_STD_LINE="CXX_STD = CXX17"
else
echo "R ${R_VERSION_STRING} detected -- using R default C++ standard"
CXX_STD_LINE="# CXX17 is the default for R >= 4.3.0"
fi

########################################################
### Configure args

Expand Down Expand Up @@ -77,7 +87,7 @@ elif test "xx$PKGCONF" != "xx"; then
ZSTD_INCLUDE_PATH=`"${PKGCONF}" --cflags-only-I libzstd`
COMPILE_ZSTD="false"
else
echo "zstd ${VERSION_STRING} library detected but is lower than bundled version (1.5.2) -- compiling from source"
echo "zstd ${VERSION_STRING} library detected but is lower than bundled version (1.5.6) -- compiling from source"
COMPILE_ZSTD="true"
fi
else
Expand Down Expand Up @@ -189,6 +199,7 @@ AC_SUBST([ZSTD_CLEAN], $ZSTD_CLEAN)
AC_SUBST([DYNAMIC_BLOCKSIZE_FLAG], $DYNAMIC_BLOCKSIZE_FLAG)
AC_SUBST([TBB_FLAG], $TBB_FLAG)
AC_SUBST([SIMD_FLAG], $SIMD_FLAG)
AC_SUBST([CXX_STD_LINE], $CXX_STD_LINE)

AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT
1 change: 1 addition & 0 deletions inst/include/qdata-cpp
Submodule qdata-cpp added at 43a300
Loading
Loading