summaryrefslogtreecommitdiff
path: root/ext
AgeCommit message (Collapse)Author
2025-03-28[ruby/json] Get rid of JSON::NOT_SETJean Boussier
https://github.com/ruby/json/commit/760d922265 Notes: Merged: https://github.com/ruby/ruby/pull/13004
2025-03-28[ruby/json] Remove outdated JSON.iconvJean Boussier
https://github.com/ruby/json/commit/3de8702354 Notes: Merged: https://github.com/ruby/ruby/pull/13004
2025-03-28[ruby/json] Cleanup JSON.pretty_generateJean Boussier
https://github.com/ruby/json/commit/01c47a0555 Notes: Merged: https://github.com/ruby/ruby/pull/13004
2025-03-28[ruby/json] Deprecate `JSON.fast_generate`Jean Boussier
https://github.com/ruby/json/commit/6508455d82 Notes: Merged: https://github.com/ruby/ruby/pull/13004
2025-03-27[ruby/psych] Format Date in ISO-8601 explicitlyNobuyoshi Nakada
Fix https://github.com/ruby/psych/pull/644 https://github.com/ruby/psych/commit/b1ade765ba
2025-03-27Get rid of SAFE_STATE_PROTOTYPEJean Boussier
It was only used by JRuby and TruffleRuby to call `SAFE_STATE_PROTOTYPE.dup` instead of `State.new` which isn't an worthy optimization. Notes: Merged: https://github.com/ruby/ruby/pull/12994
2025-03-27Refactor jeaiii-ltoa.hJean Boussier
Some relatively minor change to make the library more in line with the gem. Some renaming, etc. Notes: Merged: https://github.com/ruby/ruby/pull/12994
2025-03-27Update ext/json/generator/dependHiroshi SHIBATA
2025-03-27Removed trailing spacesHiroshi SHIBATA
2025-03-27Faster integer formattingeno
This commit provides an alternative implementation for a long → decimal conversion. The main difference is that it uses an algorithm pulled from https://github.com/jeaiii/itoa. The source there is C++, it was converted by hand to C for inclusion with this gem. jeaiii's algorithm is covered by the MIT License, see source code. On addition this version now also generates the string directly into the fbuffer, foregoing the need to run a separate memory copy. As a result, I see a speedup of 32% on Apple Silicon M1 for an integer set of benchmarks.
2025-03-27[ruby/json] Remove unused `FAST_STATE_PROTOTYPE` and `PRETTY_STATE_PROTOTYPE`Jean Boussier
https://github.com/ruby/json/commit/18e5c3c67c
2025-03-27[ruby/json] Remove `unparse` and `restore` aliases.Jean Boussier
These were deprecated 16 years ago. https://github.com/ruby/json/commit/a88d825a91
2025-03-27[ruby/json] Deprecate all `*_default_options`Jean Boussier
Globally changing the behavior of the library is a bad idea, as many different libraries may rely on `json` and may not expect it and likely never tested that a different default config works for them. If you need to change the behavior of JSON, it's best to do it only locally, and not globally. In addition the new `JSON::Coder` interface is much more suited for that. Another reason for the deprecation is that it's impossible to make `JSON.load` and `JSON.dump` Ractor-safe with such API. https://github.com/ruby/json/commit/172762c6e4
2025-03-25[ruby/etc] Etc.sysconfdir does not work in a RactorBenoit Daloze
* Because it uses RbConfig::CONFIG. * See https://github.com/ruby/ruby/actions/runs/14069312270/job/39399502142#step:12:947 https://github.com/ruby/etc/commit/12dbe03b6a
2025-03-25[ruby/etc] Most Etc methods are not Ractor-safe currentlyBenoit Daloze
* See https://bugs.ruby-lang.org/issues/21115 https://github.com/ruby/etc/commit/ae62b7619c
2025-03-24Update ext/json/generator/dependHiroshi SHIBATA
2025-03-24Removed trailing spaceHiroshi SHIBATA
2025-03-24Reorganize `fpconv` vendoringJean Boussier
Make it a single file and declare the dependency.
2025-03-24[ruby/json] Extends license descriptioneno
https://github.com/ruby/json/commit/cce3d1f6c1
2025-03-24[ruby/json] Adjust fpconv to add ".0" to integerseno
Adds a test case fix https://github.com/ruby/json/commit/fa5bdf87cb
2025-03-24[ruby/json] Faster float formattingeno
This commit provides an alternative implementation for a float → decimal conversion. It integrates a C implementation of Fabian Loitsch's Grisu-algorithm [[pdf]](http://florian.loitsch.com/publications/dtoa-pldi2010.pdf), extracted from https://github.com/night-shift/fpconv. The relevant files are added in this PR, they are, as is all of https://github.com/night-shift/fpconv, available under a MIT License. As a result, I see a speedup of 900% on Apple Silicon M1 for a float set of benchmarks. floats don't have a single correct string representation: a float like `1000.0` can be represented as "1000", "1e3", "1000.0" (and more). The Grisu algorithm converts floating point numbers to an optimal decimal string representation without loss of precision. As a result, a float that is exactly an integer (like `Float(10)`) will be converted by that algorithm into `"10"`. While technically correct – the JSON format treats floats and integers identically –, this differs from the current behaviour of the `"json"` gem. To address this, the integration checks for that case, and explicitely adds a ".0" suffix in those cases. This is sufficient to meet all existing tests; there is, however, a chance that the current implementation and this implementation occasionally encode floats differently. ``` == Encoding floats (4179311 bytes) ruby 3.4.1 (2024-12-25 revision https://github.com/ruby/json/commit/48d4efcb85) +YJIT +PRISM [arm64-darwin24] Warming up -------------------------------------- json (local) 4.000 i/100ms Calculating ------------------------------------- json (local) 46.046 (± 2.2%) i/s (21.72 ms/i) - 232.000 in 5.039611s Normalize to 2090234 byte == Encoding floats (4179242 bytes) ruby 3.4.1 (2024-12-25 revision https://github.com/ruby/json/commit/48d4efcb85) +YJIT +PRISM [arm64-darwin24] Warming up -------------------------------------- json (2.10.2) 1.000 i/100ms Calculating ------------------------------------- json (2.10.2) 4.614 (± 0.0%) i/s (216.74 ms/i) - 24.000 in 5.201871s ``` These benchmarks are run via a script ([link](https://gist.github.com/radiospiel/04019402726a28b31616df3d0c17bd1c)) which is based on the gem's `benchmark/encoder.rb` file. There are probably better ways to run benchmarks :) My version allows to combine multiple test cases into a single one. The `dumps` benchmark, which covers the JSON files in `benchmark/data/*.json` – with the exception of `canada.json` – , reported a minor speedup within statistical uncertainty. https://github.com/ruby/json/commit/7d77415108
2025-03-18[ruby/date] Add license files (COPYING, BSDL) to gem filesSusan van den Broek
https://github.com/ruby/date/commit/a3d85e0be5
2025-03-17Manage skipping instance variable IDs in one placeNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12923
2025-03-15Fix crash in TCPSocket.openLuke Jahnke
Fix segfault crash observable with TCPSocket.open(nil, nil) Notes: Merged: https://github.com/ruby/ruby/pull/12934
2025-03-13Move object_id to flags for ObjectSpace dumpsPeter Zhu
Moving object_id dumping from ObjectSpace to the GC flags allows ObjectSpace to not assume the FL_SEEN_OBJ_ID flag and instead move it to the responsibility of the GC. Notes: Merged: https://github.com/ruby/ruby/pull/12915
2025-03-13[ruby/json] Release 2.10.2Jean Boussier
https://github.com/ruby/json/commit/350c1fd154
2025-03-13[ruby/json] Fix potential out of bound read in `json_string_unescape`.Jean Boussier
https://github.com/ruby/json/commit/cf242d89a0
2025-03-12[ruby/openssl] mark `initialize_copy` as :nodoc:Sarun Rattanasiri
https://github.com/ruby/openssl/commit/17f87d2cf0
2025-03-12[ruby/json] Raise a ParserError on all incomplete unicode escape sequence.Jean Boussier
This was the behavior until `2.10.0` unadvertently changed it. `"\u1"` would raise, but `"\u1zzz"` wouldn't. https://github.com/ruby/json/commit/7d0637b9e6
2025-03-10Fix `Socket.tcp_with_fast_fallback` to be usable from a RactorJean Boussier
[Bug #21179] ``` socket.rb:1046:in 'Socket::HostnameResolutionStore#get_addrinfo': can not access non-shareable objects in constant Socket::HostnameResolutionStore::PRIORITY_ON_V6 by non-main ractor. (Ractor::IsolationError) from socket.rb:724:in 'block in Socket.tcp_with_fast_fallback' from socket.rb:720:in 'Socket.tcp_with_fast_fallback' ``` Notes: Merged: https://github.com/ruby/ruby/pull/12896
2025-03-06[ruby/json] Fix JSON::GeneratorError#detailed_message with Ruby < 3.2Rahim Packir Saibo
https://github.com/ruby/json/commit/2e015ff839
2025-02-27[ruby/json] Ensure parser error snippets are valid UTF-8Jean Boussier
Fix: https://github.com/ruby/json/issues/755 Error messages now include a snippet of the document that doesn't parse to help locate the issue, however the way it was done wasn't UTF-8 aware, and it could result in exception messages with truncated characters. It would be nice to go a bit farther and actually support codepoints, but it's a lot of complexity to do it in C, perhaps if we move that logic to Ruby given it's not a performance sensitive codepath. https://github.com/ruby/json/commit/e144793b72
2025-02-25[ruby/strscan] Fix a bug that inconsistency of IndexError vs nil forNAITOH Jun
unknown capture group (https://github.com/ruby/strscan/pull/143) Fix https://github.com/ruby/strscan/pull/139 Reported by Benoit Daloze. Thanks!!! https://github.com/ruby/strscan/commit/bc8a0d2623 Notes: Merged: https://github.com/ruby/ruby/pull/12804
2025-02-25[ruby/strscan] Fix a bug that scanning methods that don't use RegexpNAITOH Jun
don't clear named capture groups (https://github.com/ruby/strscan/pull/142) Fix https://github.com/ruby/strscan/pull/135 https://github.com/ruby/strscan/commit/b957443e20 Notes: Merged: https://github.com/ruby/ruby/pull/12804
2025-02-22Add description for Socket::Ifaddr#flags.Tanaka Akira
2025-02-21[ruby/stringio] Fix SEGV at unget to a null device StringIONobuyoshi Nakada
https://github.com/ruby/stringio/commit/eb4ee49218
2025-02-21Bump up development version of stringioHiroshi SHIBATA
2025-02-21[ruby/strscan] `scan_integer(base: 16)` ignore x suffix if notJean Boussier
followed by hexadecimal (https://github.com/ruby/strscan/pull/141) Fix: https://github.com/ruby/strscan/issues/140 `0x<EOF>`, `0xZZZ` should be parsed as `0` instead of not matching at all. https://github.com/ruby/strscan/commit/c4e4795ed2
2025-02-20[ruby/stringio] Make sure shared buffer is copied on mutationAaron Patterson
(https://github.com/ruby/stringio/pull/117) We need to ensure shared buffers are made independent on mutation. Otherwise we could end up mutating unrelated string buffers. --------- https://github.com/ruby/stringio/commit/5101cfb030 Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> Co-authored-by: Aaron Patterson <aaron.patterson@gmail.com> Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
2025-02-19Add rb_gc_object_metadata APIPeter Zhu
This function replaces the internal rb_obj_gc_flags API. rb_gc_object_metadata returns an array of name and value pairs, with the last element having 0 for the name. Notes: Merged: https://github.com/ruby/ruby/pull/12777
2025-02-19[ruby/json] Pass through all options if present.Samuel Williams
https://github.com/ruby/json/commit/bea96e0a69
2025-02-18Tweak: Add prefix to non-static function names (#12764)Misaki Shioi
to avoid conflicts with other functions. This was pointed out in https://github.com/ruby/ruby/pull/11653#discussion_r1837356617 , but it was not fixed at that time. Notes: Merged-By: shioimm <shioi.mm@gmail.com>
2025-02-17[ruby/strscan] Fix a bug that scan_until behaves differently withNAITOH Jun
Regexp and String patterns (https://github.com/ruby/strscan/pull/138) Fix https://github.com/ruby/strscan/pull/131 https://github.com/ruby/strscan/commit/e1cec2e726
2025-02-14Removed trailing spacesHiroshi SHIBATA
2025-02-14[ruby/strscan] Fix a bug that scan_integer doesn't update matchedJean Boussier
data (https://github.com/ruby/strscan/pull/133) Fix https://github.com/ruby/strscan/pull/130 Reported by Andrii Konchyn. Thanks!!! https://github.com/ruby/strscan/commit/4e5f17f87a
2025-02-14[ruby/psych] Avoid calls to `require` in hotspotsJean Boussier
Followup: https://github.com/ruby/psych/pull/686 This single call shows up as 4% of some controller actions in the lobsters benchmark. Profile: https://share.firefox.dev/3EqKnhS https://github.com/ruby/psych/commit/b77bfee092
2025-02-12[ruby/json] Release 2.10.1Jean Boussier
https://github.com/ruby/json/commit/aa5b7d6acb
2025-02-12Fix a compatibility issue with `MultiJson.dump(obj, pretty: true)`Jean Boussier
Fix: https://github.com/ruby/json/issues/748 `MultiJson` pass `State#to_h` as options, and the `as_json` property defaults to `false` but `false` wasn't accepted by the constructor.
2025-02-12[ruby/json] Release 2.10.0Jean Boussier
https://github.com/ruby/json/commit/8b56d47254
2025-02-11[ruby/openssl] x509name: do not check for negative return from ↵Kazuki Yamaguchi
X509_NAME_entry_count() The function never returns a negative number. https://github.com/ruby/openssl/commit/895ce6fdfc