smarter_json 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf6191c05bd9049082a1362f4bfa5ab3240c4690bc59c1675c716c0901d5c6cb
4
- data.tar.gz: 56f1d5418b20d8bad23694f7831dfb335ab4737dd34e9184b9c20113c41fd3aa
3
+ metadata.gz: f66007af9616269be4ccc22a5e73d784bc9991dbb5c4245e5cef15293cbc7ab8
4
+ data.tar.gz: d95cecb5d4258d44ed104c8386281e60855e196e09ed5c05e47e5ebe70b4e100
5
5
  SHA512:
6
- metadata.gz: 64c3511d1f21662b703ee1a02876ba8f05401ebcd48b1025e7290a50c49a5fc1d74623c94477b6fc7006ea782028698e298010b3e827f5ed0315fa1f7e88f595
7
- data.tar.gz: c2801263204013c23954d7f4489f7f4f38f74802c42da5cf2ba2e5965decfc6c00dd304a7ff16f9f96741e4103fd499f36efa8a8ba5ec7abfdb40dded1c996a9
6
+ metadata.gz: 4924b4a88250124b30a4d97b99d9c84ea644b922c4a0dea4fb4dfb185638b7fb43ccce2b638026d1b52d085fe7e5fceb94168edb190133684de0d94ab90f0399
7
+ data.tar.gz: 6c8493f8b1808deab9a7f039c9394c12d51076c4b670ad04df4c0b8b32d1deadfa1549d79cb2eb3200a3c2291cd652b255c061e4b210acc2426a3673a0cc33c3
data/CHANGELOG.md CHANGED
@@ -13,6 +13,12 @@
13
13
  > ⚠️ We discourage the use of `process(input).first` / `process(input)[0]` because it silently drops potential additional documents
14
14
  > Please use `process_one` if you are expecting only one JSON doc, e.g. in API payloads, because it emits on_warning if it finds multiple docs.
15
15
 
16
+ ## 1.2.1 (2026-06-17)
17
+
18
+ RSpec tests: 1,165
19
+
20
+ - Performance improvements
21
+
16
22
  ## 1.2.0 (2026-06-16)
17
23
 
18
24
  RSpec tests: 1,097 → 1,165
@@ -757,8 +757,10 @@ module SmarterJSON
757
757
  # incl. LF/CR which also terminate). Stopping at a terminator/EOF means the run had no
758
758
  # interior whitespace, so there's nothing to trim and no comment marker can apply.
759
759
  #
760
- # U+FEFF is JSON5/ES5 whitespace but not in [[:space:]], so we need to add it:
761
- QL_BREAK = /[,{}\[\]]|[[:space:]]|#{[0xFEFF].pack("U")}/.freeze
760
+ # U+FEFF is JSON5/ES5 whitespace but NOT in [[:space:]]. It is deliberately kept OUT of
761
+ # this regex: a multibyte alternative defeats byteindex's fast byte-search (~3.3x slower
762
+ # on number-dense input). A trailing U+FEFF is trimmed cheaply in the fast path below.
763
+ QL_BREAK = /[,{}\[\]]|[[:space:]]/.freeze
762
764
 
763
765
  # The defaults live centrally in SmarterJSON::Options (lib/smarter_json/options.rb).
764
766
  DEFAULT_OPTIONS = Options::DEFAULT_OPTIONS
@@ -1350,7 +1352,14 @@ module SmarterJSON
1350
1352
  b = hit < @bytesize ? input.getbyte(hit) : nil
1351
1353
  if b.nil? || b == COMMA || b == RBRACE || b == RBRACKET || b == LBRACE || b == LBRACKET || b == LF || b == CR
1352
1354
  @pos = hit
1353
- return hit
1355
+ # A trailing U+FEFF (EF BB BF) is JSON5/ES5 whitespace but not in QL_BREAK, so
1356
+ # byteindex scanned past it into the run — trim it (and a run of them). On the
1357
+ # common path the last byte is a digit/letter, so the first compare fails at once.
1358
+ fin = hit
1359
+ while fin - 3 >= pos && input.getbyte(fin - 1) == 0xBF && input.getbyte(fin - 2) == 0xBB && input.getbyte(fin - 3) == 0xEF
1360
+ fin -= 3
1361
+ end
1362
+ return fin
1354
1363
  end
1355
1364
  end
1356
1365
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SmarterJSON
4
- VERSION = "1.2.0"
4
+ VERSION = "1.2.1"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smarter_json
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tilo Sloboda
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-06-16 00:00:00.000000000 Z
10
+ date: 2026-06-17 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: bigdecimal