-
Notifications
You must be signed in to change notification settings - Fork 38
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
Implement $read_ndjson()
and $scan_ndjson()
#471
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The docs failure is due to internal changes in |
Performance looks nice: ndjson_filename <- tempfile()
df <- head(nycflights13::flights, 200000)
jsonlite::stream_out(df, file(ndjson_filename), verbose = FALSE)
bench::mark(
ndjson = ndjson::stream_in(ndjson_filename),
jsonlite = jsonlite::stream_in(file(ndjson_filename), verbose = FALSE),
jsonify = jsonify::from_ndjson(ndjson_filename),
arrow = arrow::read_json_arrow(ndjson_filename),
yyjsonr = yyjsonr::read_ndjson_file(ndjson_filename),
polars = polars::pl$read_ndjson(ndjson_filename),
check = FALSE
)
#> Registered S3 method overwritten by 'jsonify':
#> method from
#> print.json jsonlite
#> Warning: Some expressions had a GC in every iteration; so filtering is
#> disabled.
#> # A tibble: 6 × 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 ndjson 5.83s 5.83s 0.172 127.8MB 0.515
#> 2 jsonlite 7.31s 7.31s 0.137 278.3MB 0.547
#> 3 jsonify 746.98ms 746.98ms 1.34 105.1MB 1.34
#> 4 arrow 393.64ms 395.87ms 2.53 27.7MB 0
#> 5 yyjsonr 356.84ms 364.77ms 2.74 18.4MB 0
#> 6 polars 119.52ms 126.81ms 7.88 6.9MB 0 |
sorhawell
approved these changes
Nov 8, 2023
sorhawell
reviewed
Nov 8, 2023
Thanks for the review and refactor @sorhawell, I'll do the same thing for CSV reading in another PR |
etiennebacher
force-pushed
the
read-json
branch
from
November 8, 2023 11:53
f7a4f8c
to
b41d540
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TODO:
maybe refactor common bits with csv functions on the Rust side