moxml 0.6.5 → 0.6.6
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/docs/_pages/performance.adoc +21 -1
- data/docs/_pages/why-moxml.adoc +10 -3
- data/lib/moxml/adapter/leptris.rb +14 -0
- data/lib/moxml/version.rb +1 -1
- data/spec/consistency/attribute_charref_decode_spec.rb +56 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0ce816a587b7b04d7e380e081043eaa7c7f950ab1663dd4cad60203da4ce104b
|
|
4
|
+
data.tar.gz: 83f30fb1c549b17a7b9a3930da3867c535bd37c344cca4df2e879eaa51befae1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b14b18373ed2190b8088c0baa461170b85026c4b23397a82d36c118467ab58cbaeda1ad4dba317bab04463474c1dccf5d3193660bd3756ab58135152694c022d
|
|
7
|
+
data.tar.gz: 21411b8ca1fb7d8a609f4987ae5bf208d9f12c07c335bcd8741869bcf1e1826a364e2d7fd0e6c8126a194e2cdbd0beb2447c8a39e88dd6b146af91b087ed9fbe
|
|
@@ -5,6 +5,26 @@ nav_order: 11
|
|
|
5
5
|
|
|
6
6
|
== Performance considerations
|
|
7
7
|
|
|
8
|
+
=== State of the art, honestly stated
|
|
9
|
+
|
|
10
|
+
Moxml wins every parity row on the published scoreboard — parse
|
|
11
|
+
3.05x, attr pairs listing 7.35x, xpath count 3.04x, serialize 1.62x
|
|
12
|
+
of raw nokogiri — and loses exactly the structural rows, all at one
|
|
13
|
+
known place: the per-node wrapper mint and the per-read Ruby frame
|
|
14
|
+
(the facade's reads sit at ~331ns; the binding's own native read is
|
|
15
|
+
71ns — the difference is one `bind_call` frame, the same cost every
|
|
16
|
+
Ruby-level wrapper pays). The asks that remove the last frame are
|
|
17
|
+
filed upstream with the floor tables (leptris-ruby#622: hot C reads
|
|
18
|
+
parameterized by subclass or a hydrated columnar walk,
|
|
19
|
+
klass-injected result mint, C set-attribute); adoption is
|
|
20
|
+
face-probed and lands behind gates the day upstream ships, the same
|
|
21
|
+
pattern as the six bulk-crossing surfaces already adopted.
|
|
22
|
+
|
|
23
|
+
Speed is the declared non-semantic channel: none of it is bought
|
|
24
|
+
with answers. The link:conformance.html[conformance dataset] runs
|
|
25
|
+
the model's committed rows on every tier, so a faster moxml is also
|
|
26
|
+
the same moxml.
|
|
27
|
+
|
|
8
28
|
=== Scoreboard (generated)
|
|
9
29
|
|
|
10
30
|
`SCORE_PUBLISH=1 bundle exec ruby benchmark/scoreboard.rb` rewrites
|
|
@@ -31,7 +51,7 @@ Measurement: Ruby 3.3.13, leptris 1.9.383.0, nokogiri 1.19.4, 2026-10-26T23:05:1
|
|
|
31
51
|
| `plan records (typed)` | 1.09x | data | informational
|
|
32
52
|
|===
|
|
33
53
|
|
|
34
|
-
*Parity rows* must stay at or above the 0.95 measurement floor. *Structural rows* are measured and trend-locked (10% regression tolerance) while their gaps remain open: per-node wrapper
|
|
54
|
+
*Parity rows* must stay at or above the 0.95 measurement floor. *Structural rows* are measured and trend-locked (10% regression tolerance) while their gaps remain open: the per-node wrapper mint and per-read Ruby frame (the wrapper floor; removal asks filed upstream as leptris-ruby#622) and engine construction. *Data API* rows are informational.
|
|
35
55
|
// SCOREBOARD:END
|
|
36
56
|
|
|
37
57
|
=== Memory management
|
data/docs/_pages/why-moxml.adoc
CHANGED
|
@@ -59,6 +59,12 @@ checked in CI:
|
|
|
59
59
|
| The published scoreboard: parity rows are commitments; structural
|
|
60
60
|
gaps are measured and trend-locked, never hidden.
|
|
61
61
|
|
|
62
|
+
| link:conformance.html[Conformance dataset]
|
|
63
|
+
| The model's committed answers as data — 177 cases across 7
|
|
64
|
+
families, run row-for-row by the Ruby, Rust, and TypeScript tiers.
|
|
65
|
+
A mismatch on any row is a model finding, not a dialect
|
|
66
|
+
difference.
|
|
67
|
+
|
|
62
68
|
|===
|
|
63
69
|
|
|
64
70
|
Behind the pages, the consistency suite runs an engine-free
|
|
@@ -66,9 +72,10 @@ Behind the pages, the consistency suite runs an engine-free
|
|
|
66
72
|
against every adapter; a seeded **generator** checks metamorphic
|
|
67
73
|
properties over generated documents; and a whole-class **taxonomy
|
|
68
74
|
differential** compares every adapter on every input class the model
|
|
69
|
-
touches. The
|
|
70
|
-
the
|
|
71
|
-
|
|
75
|
+
touches. The same expectations export as the conformance dataset and
|
|
76
|
+
run in Rust (moxml-rs) and TypeScript (moxml-ts over the wasm
|
|
77
|
+
bundles) — one model implementation per language, all answering the
|
|
78
|
+
same rows.
|
|
72
79
|
== What Moxml is not
|
|
73
80
|
|
|
74
81
|
Moxml is not a new XML parser and does not replace the engines — it
|
|
@@ -3073,10 +3073,21 @@ module Moxml
|
|
|
3073
3073
|
# converts per call (a Node.wrap + registry hit, ~6s/3M
|
|
3074
3074
|
# allocations per million-element walk), and only mutation
|
|
3075
3075
|
# faces need the binding element.
|
|
3076
|
+
# moxml#540: the bulk export serves RAW values (its engine
|
|
3077
|
+
# loop skips the lazy entity-run decode the single getters
|
|
3078
|
+
# apply). '&' cannot occur in a decoded value except through
|
|
3079
|
+
# an undecoded reference, so any '&' in the bulk output
|
|
3080
|
+
# re-serves the whole packet through attribute_packet, whose
|
|
3081
|
+
# values ride the decoding getter. Idempotent after the
|
|
3082
|
+
# engine gains the decode: the lazy decode replaced the
|
|
3083
|
+
# attribute's view, so the re-read answers the same bytes.
|
|
3076
3084
|
if ELEMENT_ATTR_PACKET
|
|
3077
3085
|
doc, addr = attr_packet_target(element)
|
|
3078
3086
|
if doc
|
|
3079
3087
|
flat = ::Leptris::XML::Native.attribute_pairs(doc, addr)
|
|
3088
|
+
if flat.any? { |v| v.is_a?(String) && v.include?("&") }
|
|
3089
|
+
flat = ::Leptris::XML::Native.attribute_packet(doc, addr)
|
|
3090
|
+
end
|
|
3080
3091
|
return packet_attributes(flat, element)
|
|
3081
3092
|
end
|
|
3082
3093
|
end
|
|
@@ -3127,6 +3138,9 @@ module Moxml
|
|
|
3127
3138
|
binding_element = to_binding(element)
|
|
3128
3139
|
return super unless binding_element.respond_to?(:attribute_pairs)
|
|
3129
3140
|
|
|
3141
|
+
# attribute_packet (leptris_attribute_get_value) decodes
|
|
3142
|
+
# entity runs itself — moxml#540's guard applies only to the
|
|
3143
|
+
# attribute_pairs export, which serves raw values.
|
|
3130
3144
|
pairs = if ELEMENT_ATTR_PACKET
|
|
3131
3145
|
::Leptris::XML::Native
|
|
3132
3146
|
.attribute_packet(binding_element.document,
|
data/lib/moxml/version.rb
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
# moxml#540: attribute values decode character references exactly as
|
|
6
|
+
# element text does (XML 1.0 §4.6). The leptris adapter's bulk packet
|
|
7
|
+
# face served the engine's raw attribute slice — entity runs stayed
|
|
8
|
+
# literal on #attributes while #text and the named getters decoded.
|
|
9
|
+
# The re-serve through the decoding packet face closes it; this spec
|
|
10
|
+
# pins the committed answer on every adapter so no adapter can serve
|
|
11
|
+
# a raw reference again.
|
|
12
|
+
RSpec.describe "attribute values decode character references" do
|
|
13
|
+
let(:xml) do
|
|
14
|
+
'<x a="←" b="p&q" c="←" d="plain" e="	"/>'
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
let(:expected) do
|
|
18
|
+
{
|
|
19
|
+
"a" => "←",
|
|
20
|
+
"b" => "p&q",
|
|
21
|
+
"c" => "←",
|
|
22
|
+
"d" => "plain",
|
|
23
|
+
"e" => "\t",
|
|
24
|
+
}
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it "decodes hex, decimal, and named references identically to text" do
|
|
28
|
+
Moxml::Adapter::AVAILABLE_ADAPTERS.each do |name|
|
|
29
|
+
begin
|
|
30
|
+
ctx = Moxml.new(name)
|
|
31
|
+
root = ctx.parse(xml).root
|
|
32
|
+
rescue Moxml::Error, NotImplementedError, LoadError
|
|
33
|
+
next
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
got = root.attributes.to_h { |a| [a.name, a.value] }
|
|
37
|
+
expect(got).to eq(expected),
|
|
38
|
+
"#{name}: #{got.inspect}"
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "matches the element-text decode on the same document" do
|
|
43
|
+
ctx = Moxml.new(:leptris)
|
|
44
|
+
doc = ctx.parse('<x a="←">←</x>')
|
|
45
|
+
expect(doc.root.attributes.first.value).to eq(doc.root.text)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it "keeps the attribute_pairs bulk face consistent with #attributes" do
|
|
49
|
+
ctx = Moxml.new(:leptris)
|
|
50
|
+
root = ctx.parse(xml).root
|
|
51
|
+
pairs = Moxml::Adapter.load(:leptris).attribute_pairs(root.native)
|
|
52
|
+
got = pairs.to_h { |qualified, value| [qualified, value] }
|
|
53
|
+
expect(got.values_at("a", "b", "c", "d", "e"))
|
|
54
|
+
.to eq(expected.values)
|
|
55
|
+
end
|
|
56
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: moxml
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: |
|
|
14
14
|
Moxml is a unified XML manipulation library that provides a common API
|
|
@@ -326,6 +326,7 @@ files:
|
|
|
326
326
|
- sig/moxml.rbs
|
|
327
327
|
- spec/consistency/README.md
|
|
328
328
|
- spec/consistency/adapter_parity_spec.rb
|
|
329
|
+
- spec/consistency/attribute_charref_decode_spec.rb
|
|
329
330
|
- spec/consistency/citation_hygiene_spec.rb
|
|
330
331
|
- spec/consistency/conformance_families_spec.rb
|
|
331
332
|
- spec/consistency/differential_taxonomy_spec.rb
|