| Age | Commit message (Collapse) | Author |
|
Ref: https://github.com/ruby/json/issues/655
The actual buffer is still on the heap, but this saves a pair
of malloc/free.
This helps a lot on micro-benchmarks
Before:
```
ruby 3.3.4 (2024-07-09 revision https://github.com/ruby/json/commit/be1089c8ec) +YJIT [arm64-darwin23]
Warming up --------------------------------------
Oj 531.598k i/100ms
JSON reuse 417.666k i/100ms
Calculating -------------------------------------
Oj 5.735M (± 1.3%) i/s (174.35 ns/i) - 28.706M in 5.005900s
JSON reuse 4.604M (± 1.4%) i/s (217.18 ns/i) - 23.389M in 5.080779s
Comparison:
Oj: 5735475.6 i/s
JSON reuse: 4604380.3 i/s - 1.25x slower
```
After:
```
ruby 3.3.4 (2024-07-09 revision https://github.com/ruby/json/commit/be1089c8ec) +YJIT [arm64-darwin23]
Warming up --------------------------------------
Oj 518.700k i/100ms
JSON reuse 483.370k i/100ms
Calculating -------------------------------------
Oj 5.722M (± 1.8%) i/s (174.76 ns/i) - 29.047M in 5.077823s
JSON reuse 5.278M (± 1.5%) i/s (189.46 ns/i) - 26.585M in 5.038172s
Comparison:
Oj: 5722283.8 i/s
JSON reuse: 5278061.7 i/s - 1.08x slower
```
Bench:
```ruby
require 'benchmark/ips'
require 'oj'
require 'json'
json_encoder = JSON::State.new(JSON.dump_default_options)
test_data = [1, "string", { a: 1, b: 2 }, [3, 4, 5]]
Oj.default_options = Oj.default_options.merge(mode: :compat)
Benchmark.ips do |x|
x.config(time: 5, warmup: 2)
x.report("Oj") do
Oj.dump(test_data)
end
x.report("JSON reuse") do
json_encoder.generate(test_data)
end
x.compare!(order: :baseline)
end
```
https://github.com/ruby/json/commit/72110f7992
|
|
https://github.com/ruby/json/commit/7f079b25be
|
|
This regressed since 2.7.2.
https://github.com/ruby/json/commit/35407d6635
|
|
Fix: https://github.com/ruby/json/pull/625
Declaring the buffer in a sub block cause bugs on some compilers.
https://github.com/ruby/json/commit/90967c9eb0
|
|
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
|
|
https://github.com/ruby/json/commit/d4968d2e48
|
|
Closes: https://github.com/ruby/json/pull/512
https://github.com/ruby/json/commit/d882a45d82
Co-Authored-By: lukeg <luke.gru@gmail.com>
|
|
Fix: https://github.com/ruby/json/issues/534
Only include up to 32 bytes of unparseable the source.
https://github.com/ruby/json/commit/f44995cfb6
|
|
https://github.com/ruby/json/commit/09e1df2643
|
|
https://github.com/ruby/json/commit/1a9af430d2
|
|
Avoid needless hash allocations and such that degrade performance
significantly on micro-benchmarks.
|
|
Fix: https://github.com/ruby/json/issues/419
|
|
https://github.com/ruby/json/commit/db9a489ca2
|
|
Extracted from: https://github.com/ruby/json/pull/512
Use `rb_hash_lookup2` to check for hash key existence instead
of going through `rb_funcall`.
https://github.com/ruby/json/commit/43835a0d13
Co-Authored-By: lukeg <luke.gru@gmail.com>
|
|
Some changes were missed in the automatic sync.
Notes:
Merged: https://github.com/ruby/ruby/pull/11911
|
|
All these macros are available on Ruby 2.3+
https://github.com/ruby/json/commit/227885f460
|
|
All of these are for rubies older than 2.3.
https://github.com/ruby/json/commit/811297f86a
|
|
https://github.com/ruby/json/commit/53409bcc74
|
|
I, Luke T. Shumaker, am the sole author of the added code.
I did not reference CVTUTF when writing it. I did reference the
Unicode standard (15.0.0), the Wikipedia article on UTF-8, and the
Wikipedia article on UTF-16. When I saw some tests fail, I did
reference the old deleted code (but a JSON-specific part, inherently
not as based on CVTUTF) to determine that script_safe should also
escape U+2028 and U+2029.
I targeted simplicity and clarity when writing the code--it can likely
be optimized. In my mind, the obvious next optimization is to have it
combine contiguous non-escaped characters into just one call to
fbuffer_append(), instead of calling fbuffer_append() for each
character.
Regarding the use of the "modern" types `uint32_t`, `uint16_t`, and
`bool`:
- ruby.h is guaranteed to give us uint32_t and uint16_t.
- Since Ruby 3.0.0, ruby.h is guaranteed to give us bool... but we
support down to Ruby 2.3. But, ruby.h is guaranteed to give us
HAVE_STDBOOL_H for the C99 stdbool.h; so use that to include
stdbool.h if we can, and if not then fall back to a copy of the
same bool definition that Ruby 3.0.5 uses with C89.
https://github.com/ruby/json/commit/c96351f874
|
|
I did this based on manual inspection, comparing the code to my re-created
history of CVTUTF at https://git.lukeshu.com/2git/cvtutf/ (created by the
scripts at https://git.lukeshu.com/2git/cvtutf-make/)
https://github.com/ruby/json/commit/0819553144
|
|
`json` requires Ruby 2.3, so `HAVE_RUBY_ENCODING_H` and `HAVE_RB_ENC_RAISE`
are always true.
https://github.com/flori/json/commit/5c8dc6b70a
|
|
The json gem now requires Ruby 2.3, so there is no point keeping
compatibility code for older releases that don't have the
TypedData API.
https://github.com/flori/json/commit/45c86e153f
|
|
|
|
> https://github.com/flori/json/pull/525
> Rename escape_slash in script_safe and also escape E+2028 and E+2029
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
> https://github.com/flori/json/pull/454
> Remove unnecessary initialization of create_id in JSON.parse()
Co-authored-by: Watson <watson1978@gmail.com>
|
|
They are allocated with ruby_xmalloc, they should be freed with
ruby_xfree.
|
|
Previously in the JSON::Ext parser, when we encountered an "Infinity"
token (and weren't allowing NaN/Infinity) we would try to display the
"unexpected token" at the character before.
https://github.com/flori/json/commit/42ac170712
|
|
https://github.com/flori/json/commit/82a75ba98e
Notes:
Merged: https://github.com/ruby/ruby/pull/8091
|
|
https://github.com/flori/json/commit/ed242667b4
Notes:
Merged: https://github.com/ruby/ruby/pull/8091
|
|
This macro is defined since ruby 2.1, which is older than the required
ruby version.
https://github.com/flori/json/commit/dd1d54e78a
Notes:
Merged: https://github.com/ruby/ruby/pull/8091
|
|
https://github.com/flori/json/commit/20b80ca317
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/7310
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/7330
|
|
Split `PACKED_STRUCT` and `PACKED_STRUCT_UNALIGNED` macros into the
macros bellow:
* `RBIMPL_ATTR_PACKED_STRUCT_BEGIN`
* `RBIMPL_ATTR_PACKED_STRUCT_END`
* `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_BEGIN`
* `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_END`
Notes:
Merged: https://github.com/ruby/ruby/pull/7268
|
|
It makes testing for JSON errors very tedious. You either have
to use a Regexp or to regularly update all your assertions
when JSON is upgraded.
https://github.com/flori/json/commit/de9eb1d28e
Notes:
Merged: https://github.com/ruby/ruby/pull/6200
|
|
When `HAVE_RB_ENC_INTERNED_STR` is enabled it is possible to
pass through a null pointer to `rb_enc_interned_str` resulting
in a segfault
Fixes #495
https://github.com/flori/json/commit/b59368a8c2
|
|
https://github.com/flori/json/commit/75ada77b96
Co-authored-by: Bruno Gomes da Silva <brunojabs@gmail.com>
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/5474
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4909
|
|
https://github.com/flori/json/commit/e2ad91fc2094d3cc2f76adc6c55d420cd06f34d8
|
|
* type-limits when plain-char is unsigned
* unused-const-variable for NFA constants
|
|
[ci 2]
https://github.com/flori/json/commit/1982070cb8
|
|
https://github.com/flori/json/commit/f398769332
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4371
|
|
|
|
Stop BigDecimal-specific optimization. Instead, it tries the conversion
methods in the following order:
1. `try_convert`,
2. `new`, and
3. class-named function, e.g. `Foo::Bar.Baz` function for `Foo::Bar::Baz` class
If all the above candidates are unavailable, it fallbacks to Float.
|
|
If set to true all parsed objects will be
immediately frozen, and strings will be
deduplicated if the Ruby implementation
allows it.
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3347
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3346
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3338
|