Codync
무료 오픈소스 1:1 대안, Grok Bot과 Muse 대신
Goose 언어로 작성된 파서와 프린터로 JSON을 포맷·축소·검증하며, C로 사전 컴파일
Formats, minifies and validates JSON text with a parser and printer written in the Goose programming language (<https://github.com/aardappel/goose>) and compiled ahead of time to C, which the package
개발 도구GitHub @pedrobtz온라인운영자 미확인
써 보셨어요? 한 번만 눌러 주세요. 로그인은 필요 없어요.
저장소 정보는 아직 수집하지 않았습니다.
아직 감지된 업데이트가 없습니다. GitHub 릴리스가 나오면 여기에 보입니다.
Formats, minifies and validates JSON text with a parser and printer written in the Goose programming language (<https://github.com/aardappel/goose>) and compiled ahead of time to C, which the package bundles. Goose is a memory-safe systems language with no heap: the parsed document lives in one contiguous block linked by 4-byte relative offsets. The package replaces the Goose runtime with a small one that reports every runtime failure as an R error instead of ending the process. No Goose compile
저장소 README에서 가져옴
README 전체를 불러오는 중입니다.
README 전문 보기 ↗zugojson formats, minifies and validates JSON text. Its parser and printer are written in Goose, a memory-safe systems language with no heap, and compiled ahead of time to C. The package ships that C, so installing it needs no Goose compiler.
The package is a demonstration that Goose can be used to write R packages. It is not a replacement for jsonlite.
# install.packages("pak")
pak::pak("pedrobtz/zugojson")
zugojson builds on Linux and macOS. Windows is not supported yet.
library(zugojson)
cat(json_format('{"a": [1, 2.50, {"b": null}], "s": "x"}'))
#> {
#> "a": [
#> 1,
#> 2.5,
#> {
#> "b": null
#> }
#> ],
#> "s": "x"
#> }
json_minify('{ "a" : [ 1, 2 ] }')
#> [1] "{\"a\":[1,2]}"
json_valid(c("[1, 2]", "[1, 2", NA))
#> [1] TRUE FALSE NA
A syntax error is a condition of class zugojson_parse_error. Its byte
field holds the offset where parsing stopped.
tryCatch(json_format("[1, 2"), zugojson_parse_error = function(e) e$byte)
#> [1] 5
The JSON code is in tools/goose/zugojson.goose. tools/regenerate.sh
compiles it with a pinned Goose compiler into src/zugojson_goose.c, a C
file with no main.
The parsed document lives in one contiguous block. Each node links to its next sibling with a 4-byte offset relative to itself, so the tree holds no pointers.
Generated Goose code needs a runtime. The stock runtime ends the process on
any error, writes to stdout and stderr, and installs process-wide signal
handlers. That is unacceptable inside R, so zugojson replaces it with
src/goose_r_runtime.c:
zugojson_runtime_error, and later calls keep working.zugojson is about as fast as jsonlite 2.0.0. The table gives seconds for
four documents of 1 to 4 MB, built with jsonlite's toJSON(): an array of
integers, one of random doubles, one of short strings and a table of
records. Each time is the best of five runs, with R 4.5.2 on macOS.
| Document | Task | zugojson | jsonlite |
|---|---|---|---|
| Integers | Minify | 0.017 s | 0.014 s |
| Pretty-print | 0.019 s | 0.020 s | |
| Validate | 0.013 s | 0.009 s | |
| Doubles | Minify | 0.033 s | 0.028 s |
| Pretty-print | 0.035 s | 0.034 s | |
| Validate | 0.019 s | 0.018 s | |
| Strings | Minify | 0.007 s | 0.008 s |
| Pretty-print | 0.007 s | 0.010 s | |
| Validate | 0.003 s | 0.004 s | |
| Records | Minify | 0.020 s | 0.032 s |
| Pretty-print | 0.023 s | 0.044 s | |
| Validate | 0.012 s | 0.016 s |
zugojson is MIT licensed. The Goose-derived files are under Apache-2.0, as
listed in inst/COPYRIGHTS.