leptris 1.9.54-aarch64-linux-musl → 1.9.55-aarch64-linux-musl
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 +47 -0
- data/README.adoc +5 -2
- data/Rakefile +1 -1
- data/lib/leptris/version.rb +1 -1
- data/lib/leptris/xml/document.rb +1 -1
- data/lib/leptris/xml/element.rb +3 -2
- data/lib/leptris/xml/ffi.rb +22 -5
- data/lib/leptris/xml/serialization.rb +18 -0
- data/lib/libleptris.so +0 -0
- 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: 8f9792c5d017627b5beb09770a879bb870a5b3dc724fcdb5f07561ad83a339ba
|
|
4
|
+
data.tar.gz: 7eba8cd00b0e1d3bdbf6f0201a6c03b36953094ee7cd17cc6c168202e2fb9aa1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cf7e5708b4d6f42b918bc7417a02764388097761decc97c40a8733c8e90c8f9d1f9c3ef253354b185fe08cd2eb0da4c867462252124673cc6acb3007a25800bd
|
|
7
|
+
data.tar.gz: 869ad36b1498a374986d137011c2bd40587f8979095e08e65df37bb40ba9d84f76d72989dcaabbb73e58dd6b67040c6964f3ea42833f07732b349d25d45b7ad4
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,53 @@ 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.55] - 2026-09-02
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- **Lockstep with libleptris 1.9.50**: XPath 2.0 type operators —
|
|
13
|
+
`instance of`, `castable as`, `cast as`, `treat as` with
|
|
14
|
+
SequenceType v1 (`node()`, `item()`, occurrence `*`/`+`) —
|
|
15
|
+
resolving standalone from `#xpath`, specced against the Saxon
|
|
16
|
+
ground truth including the falsifiable negative
|
|
17
|
+
(`'x' castable as xs:integer` = false, `1.9 cast as xs:integer`
|
|
18
|
+
= 1). No new C surface (audit 255/255).
|
|
19
|
+
- **README**: the standalone-subset example block grows the type
|
|
20
|
+
operators; the #683 gap list drops sequence types (still out:
|
|
21
|
+
value comparators, quantifiers, `intersect`/`except`, string
|
|
22
|
+
templates, XQuery).
|
|
23
|
+
|
|
24
|
+
### Improved
|
|
25
|
+
|
|
26
|
+
- **Serialize + inner_html, one dispatch instead of two**: the
|
|
27
|
+
`_serialize_into` contract is snprintf-like (the return is
|
|
28
|
+
always the bytes needed incl. NUL; the copy happens only when
|
|
29
|
+
the buffer fits), so `serialize_into_string` now fills the
|
|
30
|
+
grow-only byte scratch opportunistically and probes the size
|
|
31
|
+
only when a child outgrows it — previously every call paid a
|
|
32
|
+
size-probe dispatch before the fill. The bound serializer
|
|
33
|
+
methods are hoisted to constants (`Element#to_xml` and
|
|
34
|
+
`Document#to_xml` allocated a Method object per call), and
|
|
35
|
+
`inner_html` serializes element children through a dedicated
|
|
36
|
+
default-options fast path (no kwargs, no options rebuild).
|
|
37
|
+
Measured on a 1.0 MB / 42k-element document: document serialize
|
|
38
|
+
1.1x → **3.2x faster** than Nokogiri 1.19.4; `inner_html` 0.8x →
|
|
39
|
+
**4.4x faster** (4.2 ms → 1.1 ms per 200 elements). Parse (11x),
|
|
40
|
+
attr reads (9x), text aggregation (11x), and element_children
|
|
41
|
+
walks (parity) all hold.
|
|
42
|
+
|
|
43
|
+
### Fixed
|
|
44
|
+
|
|
45
|
+
- **#120 closed with a guard**: text ampersands escape on
|
|
46
|
+
serialize — byte-parity specs (parse-and-serialize round-trip
|
|
47
|
+
plus a `content=` write path) now run on every CI leg including
|
|
48
|
+
both Linuxes, so a platform-build serializer divergence fails CI
|
|
49
|
+
instead of shipping. The 1.9.50 Linux build was superseded per
|
|
50
|
+
the verification on the issue.
|
|
51
|
+
- **#124 filed upstream** (leptris/leptris#745): the C-side
|
|
52
|
+
non-standard-entity pre-scan entry — the moxml +61% parse → ~+2%
|
|
53
|
+
case. The binding attaches and wraps it the day it lands.
|
|
54
|
+
|
|
8
55
|
## [1.9.54] - 2026-09-02
|
|
9
56
|
|
|
10
57
|
### Changed
|
data/README.adoc
CHANGED
|
@@ -239,6 +239,9 @@ doc.xpath("count(1 to 4)") # => 4.0
|
|
|
239
239
|
doc.xpath("//book => count()") # 3.1 arrow
|
|
240
240
|
doc.xpath("//title ! string(.)") # 3.1 simple map
|
|
241
241
|
doc.xpath("'v' || count(//book)") # 3.1 concat
|
|
242
|
+
doc.xpath("'42' castable as xs:integer") # 2.0 type ops
|
|
243
|
+
doc.xpath("1.9 cast as xs:integer") # => 1.0 (truncates)
|
|
244
|
+
doc.xpath("//title instance of node()+") # 2.0 sequence types
|
|
242
245
|
----
|
|
243
246
|
|
|
244
247
|
Two caveats: `for … return` sequences come back as opaque result
|
|
@@ -247,8 +250,8 @@ nodes — consume them through an aggregate (`count(...)`,
|
|
|
247
250
|
items; and XQuery-only syntax (`order by`, `try/catch`, map
|
|
248
251
|
constructors) raises `XPathError` rather than evaluating silently
|
|
249
252
|
wrong. The remaining grammar gaps — value comparators (`eq`),
|
|
250
|
-
quantifiers,
|
|
251
|
-
|
|
253
|
+
quantifiers, `intersect`/`except`, string templates — and XQuery
|
|
254
|
+
itself are
|
|
252
255
|
https://github.com/leptris/leptris/issues/683[tracked upstream].
|
|
253
256
|
|
|
254
257
|
=== Supported CSS selectors
|
data/Rakefile
CHANGED
|
@@ -8,7 +8,7 @@ RSpec::Core::RakeTask.new(:spec)
|
|
|
8
8
|
# Pin for `rake compile` and the platform-gem builds. Keep in lockstep
|
|
9
9
|
# with .github/workflows/build.yml (which calls `rake compile`) and the
|
|
10
10
|
# CHANGELOG when libleptris releases.
|
|
11
|
-
LIBLEPTRIS_VERSION = "1.9.
|
|
11
|
+
LIBLEPTRIS_VERSION = "1.9.50"
|
|
12
12
|
|
|
13
13
|
CMAKE_FLAGS = %w[
|
|
14
14
|
-DCMAKE_BUILD_TYPE=Release
|
data/lib/leptris/version.rb
CHANGED
data/lib/leptris/xml/document.rb
CHANGED
|
@@ -285,7 +285,7 @@ class Leptris::XML::Document
|
|
|
285
285
|
@c_ptr, indent: indent, no_decl: no_decl, encoding: encoding)
|
|
286
286
|
end
|
|
287
287
|
Leptris::XML::Serialization.to_xml(
|
|
288
|
-
Leptris::XML::
|
|
288
|
+
Leptris::XML::Serialization::DOCUMENT_SERIALIZE_INTO, @c_ptr,
|
|
289
289
|
indent: indent, no_decl: no_decl, encoding: encoding)
|
|
290
290
|
end
|
|
291
291
|
alias_method :to_s, :to_xml
|
data/lib/leptris/xml/element.rb
CHANGED
|
@@ -349,7 +349,8 @@ class Leptris::XML::Element < Leptris::XML::Node
|
|
|
349
349
|
def inner_html
|
|
350
350
|
children.map do |child|
|
|
351
351
|
case child
|
|
352
|
-
when Leptris::XML::Element
|
|
352
|
+
when Leptris::XML::Element
|
|
353
|
+
Leptris::XML::Serialization.element_xml_default(child.c_ptr)
|
|
353
354
|
when Leptris::XML::CDATA # before Text: CDATA subclasses it
|
|
354
355
|
"<![CDATA[#{child.content}]]>"
|
|
355
356
|
when Leptris::XML::Text
|
|
@@ -377,7 +378,7 @@ class Leptris::XML::Element < Leptris::XML::Node
|
|
|
377
378
|
return Leptris::XML::Serialization.to_xml_element_unit(
|
|
378
379
|
self, indent_text, indent: indent) if indent_text.is_a?(String)
|
|
379
380
|
Leptris::XML::Serialization.to_xml(
|
|
380
|
-
Leptris::XML::
|
|
381
|
+
Leptris::XML::Serialization::ELEMENT_SERIALIZE_INTO, @c_ptr,
|
|
381
382
|
indent: indent, no_decl: no_decl, encoding: encoding)
|
|
382
383
|
end
|
|
383
384
|
|
data/lib/leptris/xml/ffi.rb
CHANGED
|
@@ -894,12 +894,29 @@ module Leptris
|
|
|
894
894
|
# leptris_element_serialize_into. The buffer holds the
|
|
895
895
|
# serialization + NUL and XML output is NUL-free, so the
|
|
896
896
|
# bounded read is exact.
|
|
897
|
+
# snprintf contract (leptris.h #535): the return is ALWAYS the
|
|
898
|
+
# bytes needed incl. the NUL; the copy happens only when the
|
|
899
|
+
# buffer fits. So the size probe is paid only when the child
|
|
900
|
+
# outgrows the grow-only scratch — one dispatch per call on
|
|
901
|
+
# the fast path instead of two (inner_html serializes each
|
|
902
|
+
# child; the probe was most of the per-child FFI cost).
|
|
903
|
+
SERIALIZE_INITIAL = 256
|
|
904
|
+
private_constant :SERIALIZE_INITIAL
|
|
905
|
+
|
|
897
906
|
def self.serialize_into_string(ffi_function, c_ptr, options)
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
buffer
|
|
901
|
-
|
|
902
|
-
|
|
907
|
+
scratch = (Thread.current[:leptris_scratch] ||= {})
|
|
908
|
+
buffer = scratch[:bytes]
|
|
909
|
+
if buffer.nil?
|
|
910
|
+
buffer = scratch[:bytes] =
|
|
911
|
+
::FFI::MemoryPointer.new(:char, SERIALIZE_INITIAL)
|
|
912
|
+
end
|
|
913
|
+
needed = ffi_function.call(c_ptr, buffer, buffer.size, nil, options)
|
|
914
|
+
if needed > buffer.size
|
|
915
|
+
buffer = scratch_bytes(needed)
|
|
916
|
+
needed = ffi_function.call(c_ptr, buffer, buffer.size, nil, options)
|
|
917
|
+
end
|
|
918
|
+
return "" if needed <= 1
|
|
919
|
+
buffer.read_string(needed - 1).force_encoding(Encoding::UTF_8)
|
|
903
920
|
end
|
|
904
921
|
|
|
905
922
|
# Byte scratch for serialize-into cycles: the size+fill pair
|
|
@@ -18,6 +18,16 @@ module Leptris::XML::Serialization
|
|
|
18
18
|
end
|
|
19
19
|
private_constant :DEFAULT_OPTIONS
|
|
20
20
|
|
|
21
|
+
# Bound serializer entries, hoisted: Element#to_xml and the
|
|
22
|
+
# inner_html per-child loop passed FFI.method(:...) — one Method
|
|
23
|
+
# allocation per serialized child.
|
|
24
|
+
ELEMENT_SERIALIZE_INTO =
|
|
25
|
+
Leptris::XML::FFI.method(:leptris_element_serialize_into)
|
|
26
|
+
DOCUMENT_SERIALIZE_INTO =
|
|
27
|
+
Leptris::XML::FFI.method(:leptris_document_serialize_into)
|
|
28
|
+
# Public within the library: Element#to_xml and Document#to_xml
|
|
29
|
+
# pass the hoisted bound methods straight through.
|
|
30
|
+
|
|
21
31
|
# +ffi_function+ is a bound _serialize_into function. The buffer
|
|
22
32
|
# cycle lives at the FFI seam (FFI.serialize_into_string); this
|
|
23
33
|
# module owns only options selection and construction.
|
|
@@ -33,6 +43,14 @@ module Leptris::XML::Serialization
|
|
|
33
43
|
Leptris::XML::FFI.serialize_into_string(ffi_function, c_ptr, opts.pointer)
|
|
34
44
|
end
|
|
35
45
|
|
|
46
|
+
# Default-options element serialization for inner_html's per-child
|
|
47
|
+
# loop: no kwargs, no options rebuild, no method allocation —
|
|
48
|
+
# one FFI fast-path dispatch per child.
|
|
49
|
+
def self.element_xml_default(c_ptr)
|
|
50
|
+
Leptris::XML::FFI.serialize_into_string(
|
|
51
|
+
ELEMENT_SERIALIZE_INTO, c_ptr, DEFAULT_OPTIONS.pointer)
|
|
52
|
+
end
|
|
53
|
+
|
|
36
54
|
# Display-form document serialization (libleptris 1.9.9, #129):
|
|
37
55
|
# the ext struct's indent_text hands ALL whitespace to the
|
|
38
56
|
# formatter — text and mixed content indent too. Display-oriented:
|
data/lib/libleptris.so
CHANGED
|
Binary file
|