moxml 0.5.63 → 0.5.65
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/benchmark/plan_bench.rb +13 -2
- data/lib/moxml/adapter/leptris.rb +7 -2
- data/lib/moxml/version.rb +1 -1
- data/spec/moxml/struct_plan_spec.rb +4 -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: 3199cfc9977bc376a2891483d0210b1e75255fecd068e250f840bfbf11f9f901
|
|
4
|
+
data.tar.gz: 2e523e1b057c29dac0f001262052b4160ad768ec382660a7996540f19e15ec97
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0e56ded22262fe1664d425d34d4d254ebf5e27d6bde8072903f66c70a1556191819246cd3be6b76d2ea0dadfcd5ad92f8e3bb03b3214b21e2a0d013e259c58ed
|
|
7
|
+
data.tar.gz: 63906cfa37fefc1d7527c94963100992461d38bbd7914ebd6c60796a431b0438ec1432ed8810bce084280c856c62858615130be476648dac63bf50095cd5382d
|
data/benchmark/plan_bench.rb
CHANGED
|
@@ -115,9 +115,13 @@ struct_run
|
|
|
115
115
|
wrapper_run
|
|
116
116
|
nokogiri_run
|
|
117
117
|
|
|
118
|
+
nil
|
|
119
|
+
nil
|
|
118
120
|
struct_us = nil
|
|
119
121
|
struct_allocs = nil
|
|
120
|
-
|
|
122
|
+
c_face = Moxml::Adapter::Leptris.const_defined?(:NATIVE_PLAN_STRUCTS) &&
|
|
123
|
+
Moxml::Adapter::Leptris::NATIVE_PLAN_STRUCTS
|
|
124
|
+
if c_face
|
|
121
125
|
struct_us, struct_allocs = bench { struct_run }
|
|
122
126
|
end
|
|
123
127
|
plan_us, plan_allocs = bench { plan_run }
|
|
@@ -136,5 +140,12 @@ puts format("nokogiri (parse+walk) %<t>8.0f us %<a>7d allocs",
|
|
|
136
140
|
t: nk_us, a: nk_allocs)
|
|
137
141
|
puts format("plan/nokogiri %<r>.2fx (ceiling 1.50x for the CI lock)",
|
|
138
142
|
r: plan_us / nk_us)
|
|
143
|
+
if struct_us
|
|
144
|
+
puts format("struct/nokogiri %<r>.2fx (ceiling 1.50x for the CI lock)",
|
|
145
|
+
r: struct_us / nk_us)
|
|
146
|
+
end
|
|
139
147
|
|
|
140
|
-
|
|
148
|
+
if ENV["LEPTRIS_BENCH_LOCK"]
|
|
149
|
+
exit(1) if plan_us > nk_us * 1.5
|
|
150
|
+
exit(1) if struct_us && struct_us > nk_us * 1.5
|
|
151
|
+
end
|
|
@@ -538,9 +538,14 @@ module Moxml
|
|
|
538
538
|
Gem::Version.new(::Leptris::VERSION) >= Gem::Version.new("1.9.193.4")
|
|
539
539
|
|
|
540
540
|
# leptris-ruby#266 (binding 1.9.197.1): Native.plan_structs —
|
|
541
|
-
# the C struct executor behind Moxml::StructPlan.
|
|
541
|
+
# the C struct executor behind Moxml::StructPlan. The probe
|
|
542
|
+
# guards the version gate: a numerically newer lockstep can
|
|
543
|
+
# publish without the face (1.9.199.0 shipped without it),
|
|
544
|
+
# and the gate alone would NoMethodError.
|
|
542
545
|
NATIVE_PLAN_STRUCTS =
|
|
543
|
-
Gem::Version.new(::Leptris::VERSION) >= Gem::Version.new("1.9.197.1")
|
|
546
|
+
Gem::Version.new(::Leptris::VERSION) >= Gem::Version.new("1.9.197.1") &&
|
|
547
|
+
(!defined?(::Leptris::XML::Native) ||
|
|
548
|
+
::Leptris::XML::Native.respond_to?(:plan_structs))
|
|
544
549
|
|
|
545
550
|
def self.plan_structs(native, spec)
|
|
546
551
|
return nil unless NATIVE_PLAN_STRUCTS
|
data/lib/moxml/version.rb
CHANGED
|
@@ -56,6 +56,10 @@ RSpec.describe Moxml::StructPlan do
|
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
it "runs the C executor on leptris (not the fallback)" do
|
|
59
|
+
skip "binding lacks the C face (lockstep without it, e.g. 1.9.199.0)" unless
|
|
60
|
+
Moxml::Adapter::Leptris.const_defined?(:NATIVE_PLAN_STRUCTS) &&
|
|
61
|
+
Moxml::Adapter::Leptris::NATIVE_PLAN_STRUCTS
|
|
62
|
+
|
|
59
63
|
with_adapter(:leptris) do |ctx|
|
|
60
64
|
doc = ctx.parse(xml)
|
|
61
65
|
roots = Moxml::Adapter::Leptris.plan_structs(
|