moxml 0.5.34 → 0.5.35
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 +12 -0
- data/lib/moxml/element.rb +2 -4
- data/lib/moxml/version.rb +1 -1
- data/spec/integration/contract_parity_spec.rb +28 -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: f80e7825989e8653fcc4037f6e6a538ca28da7c6637d6bb941985bcc98d4dabf
|
|
4
|
+
data.tar.gz: 974854c0f42279c86e404e48920a2fd6e92cebbac22a7c6781bae023fa017fde
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7749417f017a166425fb18e896e6c0346475dd78cb32792fe725153512b64c384f60cf026e5d8503e7fb0878f22a3e6f92221126f98f08550a7b58ba1e65e2a4
|
|
7
|
+
data.tar.gz: 6545711a0dec77522f2965c5239c7cb8632878170e0fd6ea024be4d64515e49cd26550cf40b9dab7dda1ed2faa5e98caa0e076e0fda6781f7cc64463c520fd59
|
|
@@ -235,6 +235,18 @@ generation; `xmlns` writes keep the global bump.
|
|
|
235
235
|
| `Element#text` read | 422ns | 346ns (-18%) |
|
|
236
236
|
| `create_text` allocations | 6/node | 5/node |
|
|
237
237
|
| Bare attribute read `[]` | 714ns | 513ns (-28%) |
|
|
238
|
+
| Consumer pipeline (parse + typed walk) | 6112µs (0.50x) | 4915µs (0.67x) |
|
|
239
|
+
|
|
240
|
+
The pipeline jump has two causes: leptris 1.9.157-1.9.162 (inline
|
|
241
|
+
attribute values, TLS hoist, inline edge encoding, O(this-document)
|
|
242
|
+
free, create+append -24%) and the restoration of the bare-read
|
|
243
|
+
early return — a style edit in #205 dropped the `return`, and every
|
|
244
|
+
entity-free bare read fell through into the full resolver (correct
|
|
245
|
+
values, double the work; 15276µs on the same fixture). The parity
|
|
246
|
+
suite now pins zero attribute-list materializations for bare reads
|
|
247
|
+
on fast-path adapters — silent fall-throughs of this shape are
|
|
248
|
+
exactly what allocation counts and materialization counters catch
|
|
249
|
+
when wall-clock is noisy.
|
|
238
250
|
|
|
239
251
|
Allocations unchanged (the invalidation clears are nil-writes; the
|
|
240
252
|
read cache materializes lazily). The remaining cold-walk gap is
|
data/lib/moxml/element.rb
CHANGED
|
@@ -68,11 +68,9 @@ module Moxml
|
|
|
68
68
|
# the document and the attachment store on every read, which
|
|
69
69
|
# dominated the fast path.
|
|
70
70
|
value = adapter.bare_attr_value(@native, key)
|
|
71
|
-
if value.is_a?(String) && entity_bearing?
|
|
72
|
-
return adapter.restore_entities(value)
|
|
73
|
-
end
|
|
71
|
+
return adapter.restore_entities(value) if value.is_a?(String) && entity_bearing?
|
|
74
72
|
|
|
75
|
-
value
|
|
73
|
+
return value
|
|
76
74
|
end
|
|
77
75
|
|
|
78
76
|
cache = attribute_read_cache
|
data/lib/moxml/version.rb
CHANGED
|
@@ -63,6 +63,34 @@
|
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
+
describe "bare-read fast path (regression: #205 dropped the return)" do
|
|
67
|
+
it "answers bare reads without materializing the attribute list" do
|
|
68
|
+
doc = ctx.parse(%(<r><e a="1" b="2"/></r>))
|
|
69
|
+
e = doc.root.children.first
|
|
70
|
+
|
|
71
|
+
materializations = 0
|
|
72
|
+
e.singleton_class.class_eval do
|
|
73
|
+
orig = instance_method(:attributes)
|
|
74
|
+
define_method(:attributes) do
|
|
75
|
+
materializations += 1
|
|
76
|
+
orig.bind_call(self)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
expect(e["a"]).to eq("1")
|
|
81
|
+
expect(e["b"]).to eq("2")
|
|
82
|
+
expect(e["a"]).to eq("1")
|
|
83
|
+
# Fast-path adapters (nokogiri, leptris) must not materialize;
|
|
84
|
+
# the resolver adapters answer from the materialized list and
|
|
85
|
+
# the read cache — one list walk per element per generation.
|
|
86
|
+
if ctx.config.adapter.bare_get_qname_safe?
|
|
87
|
+
expect(materializations).to eq(0)
|
|
88
|
+
else
|
|
89
|
+
expect(materializations).to be > 0
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
66
94
|
describe "qname create + namespace assignment (issue #208)" do
|
|
67
95
|
it "does not double the prefix when the name is already qualified" do
|
|
68
96
|
doc = ctx.parse(%(<r xmlns:p="urn:p"/>))
|