leptris 1.9.32-x86_64-linux → 1.9.33-x86_64-linux
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 +4 -4
- data/CHANGELOG.md +17 -0
- data/lib/leptris/version.rb +1 -1
- data/lib/leptris/xml/ffi.rb +30 -14
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 95dcd93b92ce9c9edc5bedfc209c585cd5c253c311987fc025b7f5092a488a92
|
|
4
|
+
data.tar.gz: 177a3ef596d5b7c7b67eed7aa7dc7df238aad8cf4f1a699f822d04d66d14e0f7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6c189d106ebb3ce5582529df7b43c22447f395ae2fa90abd62ec7b2e08451785e4f82d4595f7fbce224eb70902bdded6ea62a0bb5fb28b630db0668df6e8091d
|
|
7
|
+
data.tar.gz: 19c473c40439559bd3d8ef6e2e53ad2129e445f35a91f522d41a7393fb6d1ed6dcfc59ffd87583c7f74e9febcb6aa19fa91e5d2bcadefeeb9b4b38bfe6912142
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,23 @@ 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.33] - 2026-08-28
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- **Cached namespace binding sets**: every namespaced query
|
|
13
|
+
previously built its binding set from scratch (flatten the hash,
|
|
14
|
+
allocate the CStringArray wire format, `ns_set_new_from_pairs`,
|
|
15
|
+
eval, free) — ~6.7 µs of construction, 2.6× the same query
|
|
16
|
+
without namespaces on a small document. The XPath VM reads the
|
|
17
|
+
set as a const map during evaluation (vm.c) and never mutates
|
|
18
|
+
it, so sets are now cached per distinct prefix/URI vocabulary and
|
|
19
|
+
shared across queries and threads. Measured: namespaced
|
|
20
|
+
`//x:rect` 10.9 -> **6.9 µs per query (-38%)**; `at_xpath` -26%.
|
|
21
|
+
Single-pair key fast path; failed builds raise before caching;
|
|
22
|
+
symbol- and string-keyed hashes share one entry. The remaining
|
|
23
|
+
gap vs no-namespace queries is the VM's prefix resolution.
|
|
24
|
+
|
|
8
25
|
## [1.9.32] - 2026-08-28
|
|
9
26
|
|
|
10
27
|
### Fixed
|
data/lib/leptris/version.rb
CHANGED
data/lib/leptris/xml/ffi.rb
CHANGED
|
@@ -800,21 +800,37 @@ module Leptris
|
|
|
800
800
|
|
|
801
801
|
# Namespace-binding lifecycle, written once: flatten the
|
|
802
802
|
# prefix/URI hash into the alternating CStringArray wire
|
|
803
|
-
# format
|
|
804
|
-
#
|
|
805
|
-
#
|
|
803
|
+
# format and build the C set. Sets are cached per distinct
|
|
804
|
+
# vocabulary: the XPath VM reads the set as a const map
|
|
805
|
+
# during evaluation (vm.c) and never mutates it, so one set
|
|
806
|
+
# serves the process across queries and threads — building
|
|
807
|
+
# the wire format plus a C set per query cost ~6.7 µs, 2.6×
|
|
808
|
+
# a no-namespace query on a small document. Cached sets are
|
|
809
|
+
# never freed (bounded by the process's distinct namespace
|
|
810
|
+
# vocabularies — the same trade the CSS translation cache
|
|
811
|
+
# makes). Failed builds raise before caching.
|
|
812
|
+
NS_SET_CACHE = {}
|
|
813
|
+
|
|
806
814
|
def self.with_ns_set(hash)
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
815
|
+
yield ns_set_for(hash)
|
|
816
|
+
end
|
|
817
|
+
|
|
818
|
+
def self.ns_set_for(hash)
|
|
819
|
+
pairs = hash.map { |prefix, uri| [prefix.to_s, uri.to_s] }
|
|
820
|
+
key = if pairs.size == 1
|
|
821
|
+
"#{pairs[0][0]}\x00#{pairs[0][1]}"
|
|
822
|
+
else
|
|
823
|
+
pairs.sort.join("\x00")
|
|
824
|
+
end
|
|
825
|
+
NS_SET_CACHE.fetch(key) do
|
|
826
|
+
flat = pairs.flatten
|
|
827
|
+
buffer, _anchors = Leptris::XML::CStringArray.to_c(flat)
|
|
828
|
+
set = leptris_xpath_ns_set_new_from_pairs(buffer, flat.length / 2)
|
|
829
|
+
if set.null?
|
|
830
|
+
raise Leptris::XML::Error,
|
|
831
|
+
"leptris_xpath_ns_set_new_from_pairs failed"
|
|
832
|
+
end
|
|
833
|
+
NS_SET_CACHE[key] = set
|
|
818
834
|
end
|
|
819
835
|
end
|
|
820
836
|
|