Skip to content

Commit

Permalink
Updated benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
eddelbuettel committed Jan 18, 2024
1 parent 99b2226 commit c074e7d
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 8 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2024-01-17 Dirk Eddelbuettel <edd@debian.org>

* demo/simpleBenchmark.R: Add new package `yyjsonr`, styled chart
* demo/simpleParseBenchmark.R: Idem
* docs/rcppsimdjson_benchmark.png: Updated chart
* docs/rcppsimdjson_parse_benchmark.png: Idem
* docs/rcppsimdjson_both_benchmarks.png: New compiste

2023-11-28 Dirk Eddelbuettel <edd@debian.org>

* DESCRIPTION (Version, Date): Release 0.1.11
Expand Down
10 changes: 7 additions & 3 deletions demo/simpleBenchmark.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ stopifnot(need_microbenchmark=requireNamespace("microbenchmark",quietly=TRUE),
need_jsonlite=requireNamespace("jsonlite",quietly=TRUE),
need_RcppSimdJson=requireNamespace("RcppSimdJson",quietly=TRUE),
need_ndjson=requireNamespace("ndjson", quietly=TRUE),
need_RJSONIO=requireNamespace("RJSONIO", quietly=TRUE))
need_RJSONIO=requireNamespace("RJSONIO", quietly=TRUE),
need_yyjsonr=requireNamespace("yyjsonr", quietly=TRUE))

file <- system.file("jsonexamples", "twitter.json", package="RcppSimdJson")
jsontxt <- readLines(file)
Expand All @@ -15,7 +16,10 @@ res <- microbenchmark::microbenchmark(jsonify = jsonify::validate_json(jsontxt),
simdjson = RcppSimdJson::validateJSON(file),
ndjson = ndjson::validate(file),
RJSONIO = RJSONIO::isValidJSON(file),
yyjsonr = yyjsonr::read_json_file(file),
times = 100L)

print(res, order="median")
print(res, order="median", unit="relative")
res$expr <- with(res, reorder(expr, time, median))
print(res)
print(res, unit="relative")
ggplot2::autoplot(res) + ggplot2::labs(title="Parsing JSON file (or string)", caption="See 'demo/simpeBenchmark.R' in package RcppSimdJson") + tinythemes::theme_ipsum_rc()
9 changes: 6 additions & 3 deletions demo/simpleParseBenchmark.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ stopifnot(need_microbenchmark=requireNamespace("microbenchmark",quietly=TRUE),
need_RcppSimdJson=requireNamespace("RcppSimdJson",quietly=TRUE),
need_ndjson=requireNamespace("ndjson", quietly=TRUE),
need_RJSONIO=requireNamespace("RJSONIO", quietly=TRUE),
need_ggplot2=requireNamespace("ggplot2", quietly=TRUE))
need_ggplot2=requireNamespace("ggplot2", quietly=TRUE),
need_yyjsonr=requireNamespace("yyjsonr", quietly=TRUE))

file <- system.file("jsonexamples", "twitter.json", package="RcppSimdJson")
json <- paste(readLines(file), collapse="")
Expand All @@ -16,8 +17,10 @@ res <- microbenchmark::microbenchmark(jsonify = jsonify::from_json(json),
simdjson = RcppSimdJson::fparse(json),
ndjson = ndjson::flatten(json),
RJSONIO = RJSONIO::fromJSON(json),
yyjsonr = yyjsonr::read_json_str(json),
times = 100L)

res$expr <- with(res, reorder(expr, time, median))
res
ggplot2::autoplot(res)
print(res)
print(res, unit="relative")
ggplot2::autoplot(res) + ggplot2::labs(title="Parsing JSON string", caption="See 'demo/simpeParseBenchmark.R' in package RcppSimdJson") + tinythemes::theme_ipsum_rc()
Binary file modified docs/rcppsimdjson_benchmark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/rcppsimdjson_both_benchmarks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/rcppsimdjson_parse_benchmark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
\newcommand{\ghpr}{\href{https://github.com/eddelbuettel/rcppsimdjson/pull/#1}{##1}}
\newcommand{\ghit}{\href{https://github.com/eddelbuettel/rcppsimdjson/issues/#1}{##1}}

\section{Changes in version 0.1.12 (unreleased)}{
\itemize{
\item Updated benchmarks now include `yyjsonr`
}
}

\section{Changes in version 0.1.11 (2023-11-28)}{
\itemize{
\item \code{RcppExports.cpp} has been regenerated under an update
\pkg{Rcpp} to address a \code{print} format warning (Dirk in \ghpr{88}).
\item \code{RcppExports.cpp} has been regenerated under an updated
\pkg{Rcpp} to address a \code{printf} format warning (Dirk in \ghpr{88}).
}
}

Expand Down

0 comments on commit c074e7d

Please sign in to comment.