leptris 1.9.26 → 1.9.27

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: 4c1650cd7d5f1be133b6c265c5ea6bfd646265ac443a86361bb30593dd0d255a
4
- data.tar.gz: babd8da0971c8f6820f2692e7283d249cea85455f84620a73e86fe488caa1a18
3
+ metadata.gz: 42dec4b3313ea805ec507734e16907a059f894b85057eef2bd1f51833440ba8a
4
+ data.tar.gz: 7163fb0b7ae9d1e5116f1d637bbb8905dfa94dd7a383c4c358174e82caa70cd0
5
5
  SHA512:
6
- metadata.gz: 62d2b51adc4bd84f8a3f6c0ebc749ad328b1ceed1d9a6502234819e0c5f3bf054ac758f008beba3692f2781981d7a4de23dc0e0d6f44462f2e3d385c2eb468e8
7
- data.tar.gz: 22a1369e2755c016019691507c2e867e792352fcd999be595c9fd485934f6170f44ce4320366487b1f0d30fd314b6db4941773663a6722b542af501ebc131bac
6
+ metadata.gz: c9b449e54b8eecfea8ba76f07b8f7169e37c2ee1aee601e84b836052b05b1811857e7674b29fd93980754b82a53508146c26e3d7054003e82129cb536ec426aa
7
+ data.tar.gz: b1dba812e5317c7f9c806183277816e06e4847ece3432f231991d3435c55ae03b43debf23d16d3199a71ce79e7ee66031a92fa33528faa5ce32473e37fa84f2e
data/CHANGELOG.md CHANGED
@@ -5,6 +5,29 @@ All notable changes to Leptris will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.9.27] - 2026-08-28
9
+
10
+ ### Fixed
11
+
12
+ - **Arity-declared attrs interest in SAX** (round XIX's policy
13
+ completed): a handler whose `start_element` takes exactly one
14
+ argument declares name-only — the attribute walk (2N pointer
15
+ reads + N string pairs per start) never runs. Measured
16
+ elements-only on big.xml: 116 -> **40 ms per parse (2.9x; the
17
+ no-walk ceiling is 3.7x)**. This also fixes a crash: 1-argument
18
+ `start_element` handlers previously raised ArgumentError because
19
+ the callback always dispatched both arguments (Nokogiri raises
20
+ there too; we now honor the signature). Optional-argument and
21
+ splat handlers keep receiving pairs exactly as before.
22
+
23
+ ### Meta
24
+
25
+ - Upstream check: no libleptris 1.9.8 exists (tarball probe 404s);
26
+ 1.9.7 remains latest. Two perf hypotheses benchmarked and
27
+ retired this round: `Element#content` is already a memoized
28
+ one-C-call read, and `Node#traverse`'s C callback dispatch
29
+ (181 ms) beats Ruby children-recursion (551 ms) 3x — both stay.
30
+
8
31
  ## [1.9.26] - 2026-08-28
9
32
 
10
33
  ### Added
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leptris
4
- VERSION = "1.9.26"
4
+ VERSION = "1.9.27"
5
5
  end
@@ -105,9 +105,21 @@ class Leptris::XML::SAX::Parser
105
105
  end
106
106
 
107
107
  if overridden?(:start_element)
108
- s[:start_element] = callback(:void, [:pointer, :string, :pointer]) do |_, name, attrs_ptr|
109
- attrs = walk_attr_array(attrs_ptr)
110
- handler.start_element(utf8(name), attrs)
108
+ # Arity-declared interest: a start_element that takes exactly
109
+ # one argument declares name-only — the attr walk (2N pointer
110
+ # reads + N string pairs per start; 3.7x of an elements-only
111
+ # parse on the 1.9 MB stream) never runs. It is also the only
112
+ # way a 1-arg handler can receive events: the two-argument
113
+ # call raises ArgumentError.
114
+ if @document.method(:start_element).arity == 1
115
+ s[:start_element] = callback(:void, [:pointer, :string, :pointer]) do |_, name, _|
116
+ handler.start_element(utf8(name))
117
+ end
118
+ else
119
+ s[:start_element] = callback(:void, [:pointer, :string, :pointer]) do |_, name, attrs_ptr|
120
+ attrs = walk_attr_array(attrs_ptr)
121
+ handler.start_element(utf8(name), attrs)
122
+ end
111
123
  end
112
124
  end
113
125
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.26
4
+ version: 1.9.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.