moxml 0.6.2 → 0.6.4
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/bench/calibrate_520.rb +89 -0
- data/docs/_pages/divergences.adoc +31 -0
- data/lib/moxml/adapter/leptris.rb +444 -34
- data/lib/moxml/config.rb +43 -10
- data/lib/moxml/context.rb +31 -9
- data/lib/moxml/version.rb +1 -1
- data/lib/moxml/xsd.rb +436 -2
- data/spec/moxml/adapter/leptris_attribute_packet_spec.rb +79 -0
- data/spec/moxml/adapter/leptris_children_address_spec.rb +171 -0
- data/spec/moxml/adapter/leptris_composed_schema_spec.rb +126 -0
- data/spec/moxml/adapter/leptris_spec.rb +0 -6
- data/spec/moxml/config_degradation_spec.rb +84 -12
- data/spec/moxml/xsd_composed_spec.rb +183 -0
- metadata +7 -3
- data/spec/moxml/adapter/leptris_children_columnar_spec.rb +0 -146
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ded5a4e91431d2dc0aa52f5ed3a013dafe8ff9dc5dbcb3490a4793c2e50882bc
|
|
4
|
+
data.tar.gz: 132da396e0ecb742951521cfcc12f04e1a250bd81607d8f0b9a00db1c926712f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: df4fc2b129067c6ae6a7571abd150dcc53851e71a234cc11513842bddc45e4534502a983bd61c952ba8db8b54f85beefb9dc01dc4893e5df9155482ea2119758
|
|
7
|
+
data.tar.gz: 5703c216bd7bfd25da921e8c3b9f0dc9e87df3112cd644809a4564c1903007687611f1d734a8515b3477b8f75b6133eeb62ce0196a3d7ba6a4f3c1522448fb02
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# moxml#520 calibration: raw engine parse vs moxml adapter parse, per engine,
|
|
4
|
+
# on the plateau_all_packages_export.xmi corpus (103 MB).
|
|
5
|
+
# Usage: ruby calibrate.rb raw-lep | raw-noko | mox-lep | mox-noko
|
|
6
|
+
|
|
7
|
+
require "pathname"
|
|
8
|
+
CORPUS = "/Users/mulgogi/src/mn/mn-samples-plateau-cg3/sources/xmi/plateau_all_packages_export.xmi"
|
|
9
|
+
CONTENT = File.read(CORPUS, mode: "rb").freeze
|
|
10
|
+
|
|
11
|
+
def measure(label)
|
|
12
|
+
GC.start
|
|
13
|
+
before = GC.stat(:total_allocated_objects)
|
|
14
|
+
rss0 = `ps -o rss= -p #{Process.pid}`.to_i
|
|
15
|
+
t0 = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
16
|
+
result = yield
|
|
17
|
+
dt = Process.clock_gettime(Process::CLOCK_MONOTONIC) - t0
|
|
18
|
+
rss1 = `ps -o rss= -p #{Process.pid}`.to_i
|
|
19
|
+
after = GC.stat(:total_allocated_objects)
|
|
20
|
+
puts format(
|
|
21
|
+
"%<label>-24s %<dt>7.2fs allocs %<allocs>9.2fM rss %<rss0>6.0f -> %<rss1>6.0f MB",
|
|
22
|
+
label: label, dt: dt, allocs: (after - before) / 1e6,
|
|
23
|
+
rss0: rss0 / 1024.0, rss1: rss1 / 1024.0
|
|
24
|
+
)
|
|
25
|
+
result
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
case ARGV[0]
|
|
29
|
+
when "raw-lep"
|
|
30
|
+
require "fiddle"
|
|
31
|
+
require "fiddle/import"
|
|
32
|
+
module Lep
|
|
33
|
+
extend Fiddle::Importer
|
|
34
|
+
|
|
35
|
+
dlload File.expand_path("~/src/leptris/leptris-rs/.local-lib/libleptris.dylib")
|
|
36
|
+
extern "void *leptris_parse_string(const char *, size_t, int *)"
|
|
37
|
+
extern "void leptris_document_free(void *)"
|
|
38
|
+
end
|
|
39
|
+
measure("raw libleptris parse") do
|
|
40
|
+
st = [0].pack("l").freeze
|
|
41
|
+
buf = "#{CONTENT}\0"
|
|
42
|
+
doc = Lep.leptris_parse_string(buf, CONTENT.bytesize, st)
|
|
43
|
+
raise "parse failed status #{st.unpack1('l')}" if doc.null?
|
|
44
|
+
|
|
45
|
+
Lep.leptris_document_free(doc)
|
|
46
|
+
end
|
|
47
|
+
when "raw-noko"
|
|
48
|
+
require "nokogiri"
|
|
49
|
+
measure("raw nokogiri parse") do
|
|
50
|
+
d = Nokogiri::XML(CONTENT, &:noblanks)
|
|
51
|
+
raise "no root" unless d.root
|
|
52
|
+
|
|
53
|
+
nil
|
|
54
|
+
end
|
|
55
|
+
when "mox-lep", "mox-noko"
|
|
56
|
+
require "moxml"
|
|
57
|
+
adapter = ARGV[0] == "mox-lep" ? :leptris : :nokogiri
|
|
58
|
+
ctx = Moxml.new(adapter)
|
|
59
|
+
measure("moxml #{adapter} parse") do
|
|
60
|
+
doc = ctx.parse(CONTENT)
|
|
61
|
+
raise "no root" unless doc.root
|
|
62
|
+
|
|
63
|
+
doc
|
|
64
|
+
end
|
|
65
|
+
when "walk-lep", "walk-noko"
|
|
66
|
+
require "moxml"
|
|
67
|
+
adapter = ARGV[0] == "walk-lep" ? :leptris : :nokogiri
|
|
68
|
+
ctx = Moxml.new(adapter)
|
|
69
|
+
doc = ctx.parse(CONTENT)
|
|
70
|
+
measure("moxml #{adapter} walk") do
|
|
71
|
+
seen = 0
|
|
72
|
+
stack = [doc.root]
|
|
73
|
+
while (el = stack.pop)
|
|
74
|
+
seen += 1
|
|
75
|
+
el.name
|
|
76
|
+
el.attributes.each do |k, a|
|
|
77
|
+
k
|
|
78
|
+
a&.value
|
|
79
|
+
end
|
|
80
|
+
el.text
|
|
81
|
+
el.children.each do |c|
|
|
82
|
+
stack << c if c.is_a?(Moxml::Element)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
puts " visited #{seen} elements"
|
|
86
|
+
end
|
|
87
|
+
else
|
|
88
|
+
abort "usage: calibrate.rb raw-lep|raw-noko|mox-lep|mox-noko"
|
|
89
|
+
end
|
|
@@ -156,3 +156,34 @@ before leptris#1866's fix (the fix itself is not the cause); not a
|
|
|
156
156
|
regression of the fix. Noted in
|
|
157
157
|
`spec/moxml/adapter/leptris_crossdoc_replace_spec.rb`.
|
|
158
158
|
|===
|
|
159
|
+
|
|
160
|
+
| D-23
|
|
161
|
+
| leptris (XSD engine lane, before 1.9.409)
|
|
162
|
+
| Strict wildcard/anyAttribute admission consulted only the head
|
|
163
|
+
unit's declaration table, so items declared in a NON-head unit of a
|
|
164
|
+
composition (xsi:schemaLocation hint documents) got "not declared
|
|
165
|
+
(strict)" rows. The facade owns the composition: Schema#validate
|
|
166
|
+
resolves the instance's hints against the schema path, walks the
|
|
167
|
+
schema graph (include/import/redefine) for the unit closure, and
|
|
168
|
+
dismisses refutable rows — global declarations AND group members
|
|
169
|
+
(moxml#528; group admission this entry's companion). RESOLVED
|
|
170
|
+
engine-side by leptris/leptris#1964 (v1.9.409, namespace-aware
|
|
171
|
+
particle typing): the 16-case W3C set (attgD019-034, attgC035-038,
|
|
172
|
+
addB114) answers VALID through the facade. Verified through the
|
|
173
|
+
lutaml-xsd conformance runner (locations registration
|
|
174
|
+
lutaml/lutaml-xsd#234); pinned in `spec/moxml/xsd_composed_spec.rb`.
|
|
175
|
+
|
|
176
|
+
| D-24
|
|
177
|
+
| leptris (XSD engine lane, 1.9.409+)
|
|
178
|
+
| The 1.9.409 namespace-aware particle typing regresses the W3C
|
|
179
|
+
schG2 composition (A imports no-ns B; expected valid): the engine
|
|
180
|
+
types the no-namespace `<e1>` variant's children against ns-a's
|
|
181
|
+
same-name declarations, so the lane answers INVALID where the model
|
|
182
|
+
says VALID. v1.9.410 (leptris/leptris#1976) fixed the element
|
|
183
|
+
resolution — the false lexical rows for the import-RESOLVED compile
|
|
184
|
+
remain: the child-typing branch still resolves the no-ns `e1`'s
|
|
185
|
+
`<a1>` against ns-a's `ct-A`, tracked upstream as
|
|
186
|
+
leptris/leptris#1979. Until it lands the lexical rows pass through
|
|
187
|
+
the facade untouched (they are not admission rows and are never
|
|
188
|
+
dismissable).
|
|
189
|
+
|===
|