leptris 1.9.40 → 1.9.41

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: 63ca61bcacf68aee02e3fb94c53f84d64af4474cf5b250482135a632b5ac2009
4
- data.tar.gz: 269dd93a547a099a5eb0685f9d58ecfa2d281d373f969cc8e69a7cd6aece5614
3
+ metadata.gz: a670640aa8b76b1d6f14f1e50b54ac329a477a6f293dc17e710524822690b0d8
4
+ data.tar.gz: cfc26d52da5bba121bfbd2d3424b4aa64acd6feb1c2a9be143f99002d16aa1fc
5
5
  SHA512:
6
- metadata.gz: d908e6a85d409bae57e50703a87be059e984a67af44139769475f6baa82631894d9cbd26390442f32af54d2987242fee8bc528f70f52e0284692fd522cb2ea23
7
- data.tar.gz: 9826c4922df24a0703eca6e39b8b6f62fe5c6deccdf5212b7e8bcc76897b74ce4cc587add6a95aa60324dcff538087cdc5bb5ba35e421a37ce0bc26a18237bad
6
+ metadata.gz: c2707588ab5775016e0bafd1554f05e872ae98f35cd9bf347471172f1f290f0daa2badda34c0dbdefdcd4c959e5ff3b5855ff1c20c034e91cbf3d508559fda74
7
+ data.tar.gz: 5ecbe0965f5e489a9e9eae2fab172a6826a0680ca64856d1a025d822b62c1e88c2badcacd5d6540b5e59144ae6ce5c0311d3e67d012afda5cc9ec0f7804fe566
data/CHANGELOG.md CHANGED
@@ -5,6 +5,20 @@ 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.41] - 2026-08-30
9
+
10
+ ### Changed
11
+
12
+ - **One thread-local access per children batch**: fetch_children
13
+ re-looked up the scratch hash inside the ints helper on every
14
+ call; both buffers now resolve through a single access (and the
15
+ kinds buffer sizes from the pointers capacity directly). Cold
16
+ full-tree walk: 254 -> 247 ms per big.xml walk (the gap vs
17
+ Nokogiri narrows 1.66x -> 1.56x — the remainder is the binding's
18
+ per-node allocation floor, re-measured and filed upstream as
19
+ leptris/leptris#645 together with the unchanged 1.64x scalar
20
+ XPath gap from #617's other half).
21
+
8
22
  ## [1.9.40] - 2026-08-30
9
23
 
10
24
  ### Changed
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leptris
4
- VERSION = "1.9.40"
4
+ VERSION = "1.9.41"
5
5
  end
@@ -911,17 +911,22 @@ module Leptris
911
911
  # (leptris_node_children_ex, 1.9.18 #617) so wrappers skip
912
912
  # the per-child get_type dispatch.
913
913
  def self.fetch_children(c_ptr)
914
+ # One thread-local access serves both buffers (the helper
915
+ # re-looked it up); the kinds buffer sizes from the POINTERS
916
+ # buffer's capacity — it may have grown past FETCH_INITIAL on
917
+ # earlier use, and C writes one kind per copied child.
914
918
  scratch = (Thread.current[:leptris_scratch] ||= {})
915
919
  buffer = scratch[:pointers]
916
920
  if buffer.nil?
917
921
  buffer = scratch[:pointers] =
918
922
  ::FFI::MemoryPointer.new(:pointer, FETCH_INITIAL)
919
923
  end
920
- # size the kinds buffer from the POINTERS buffer's capacity —
921
- # it may have grown past FETCH_INITIAL on earlier use, and C
922
- # writes one kind per copied child
923
924
  cap = buffer.size / PTR_BYTES
924
- kinds = scratch_ints(cap)
925
+ kinds = scratch[:ints]
926
+ if kinds.nil? || kinds.size / INT_BYTES < cap
927
+ kinds&.free
928
+ kinds = scratch[:ints] = ::FFI::MemoryPointer.new(:int, cap)
929
+ end
925
930
  copied = leptris_node_children_ex(c_ptr, buffer, kinds, cap)
926
931
  if copied == cap
927
932
  total = leptris_node_children_ex(c_ptr, nil, nil, 0)
@@ -929,7 +934,9 @@ module Leptris
929
934
  buffer.free
930
935
  buffer = scratch[:pointers] =
931
936
  ::FFI::MemoryPointer.new(:pointer, total)
932
- kinds = scratch_ints(total)
937
+ kinds.free
938
+ kinds = scratch[:ints] =
939
+ ::FFI::MemoryPointer.new(:int, total)
933
940
  copied = leptris_node_children_ex(c_ptr, buffer, kinds, total)
934
941
  end
935
942
  end
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.40
4
+ version: 1.9.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.