-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optimise factors_as_string #59
Comments
dcooley
added a commit
that referenced
this issue
Nov 11, 2019
may have a solution N <- 2e4
data <- data.frame(
longitude = runif(N, -180, 180),
latitude = runif(N, -180, 180),
tooltip = sample(LETTERS, N, replace = TRUE)
, stringsAsFactors = F
)
js_fac <- jsonify::to_json(data, factors_as_string = TRUE )
microbenchmark::microbenchmark(
fact = {
data$tooltip <- as.factor( data$tooltip )
js_str <- jsonify::to_json(data, factors_as_string = FALSE )
},
str = {
data$tooltip <- as.factor( data$tooltip )
js_fac <- jsonify::to_json(data, factors_as_string = TRUE )
},
times = 5
)
# Unit: milliseconds
# expr min lq mean median uq max neval
# fact 72.17386 77.94805 81.27065 78.44088 82.10928 95.68116 5
# str 55.44182 81.18584 90.39643 85.23738 88.08029 142.03680 5 |
test speed for vectors & lists too. |
This was referenced Nov 11, 2019
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
related: SymbolixAU/mapdeck#235
The text was updated successfully, but these errors were encountered: