leptris 1.9.415.0 → 1.9.416.0
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/Rakefile +1 -1
- data/lib/leptris/vendor/aarch64-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/aarch64-linux-musl/libleptris.so +0 -0
- data/lib/leptris/vendor/arm-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/arm-linux-musl/libleptris.so +0 -0
- data/lib/leptris/vendor/arm64-darwin/libleptris.dylib +0 -0
- data/lib/leptris/vendor/ppc64le-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/s390x-linux-musl/libleptris.so +0 -0
- data/lib/leptris/vendor/x86_64-darwin/libleptris.dylib +0 -0
- data/lib/leptris/vendor/x86_64-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/x86_64-linux-musl/libleptris.so +0 -0
- data/lib/leptris/version.rb +1 -1
- data/vendor-src/README.md +1 -1
- data/vendor-src/libleptris/CHANGELOG.md +15 -0
- data/vendor-src/libleptris/CMakeLists.txt +1 -1
- data/vendor-src/libleptris/README.adoc +33 -17
- data/vendor-src/libleptris/TODO.max-perf/15-c-face-vs-pugixml.md +107 -0
- data/vendor-src/libleptris/src/include/leptris/dom/document.h +10 -0
- data/vendor-src/libleptris/src/leptris/flat/direct_parse.c +34 -3
- data/vendor-src/libleptris/test/parser/test_parser.cpp +58 -0
- data/vendor-src/libleptris/vcpkg.json +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c6262e1106e7f5dfa8bae3e8d82fb8430d3971410e8fa0f728af89d473318870
|
|
4
|
+
data.tar.gz: 1707381645c1989c14b0709ef8c45f21d1a251d457b1ef082ddbe2665f1e0bff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7c74645f78ab9fde04de37490d4732d26f62220775fc8384b64072400fd1c82b6c0de5a3ebf2c1ba08fd5c73f06a5c52e37df11c9a7af7948d33885b372e0944
|
|
7
|
+
data.tar.gz: e651f62b19b386a19b5975d606ab9f3613d4da3443950462ceed1a2f2bfc35f558e493162ba6c67443708460e6bb59fe7fc5807c10cd07684871936ba418bccb
|
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.416"
|
|
12
12
|
# Vendored alongside libleptris for fn:normalize-unicode (TODO
|
|
13
13
|
# .restructure/20): built per platform with a RELOCATABLE @rpath
|
|
14
14
|
# install name, loaded by ffi.rb before libleptris so the
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/lib/leptris/version.rb
CHANGED
data/vendor-src/README.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [1.9.416] - 2026-11-11
|
|
4
|
+
## Performance
|
|
5
|
+
|
|
6
|
+
- **parse: the attribute dup-table stops rehashing small documents** (#1842 Track D). Growth was ×8, so an element with ≥14 attributes blew the 14-slot threshold inside a 16-slot table and every such document paid a 512B pool alloc + memset + full rehash on its first element; later elements memset 512B each. ×2 growth keeps the common ≤16-attr element at 32 slots (load ≤50%, ~1 probe step) with no growth, and wide elements still grow geometrically.
|
|
7
|
+
- **parse: the dup-probe fast path is inlined** in `dp_add_attr_inline` — the per-attribute out-of-line call (alloc/grow slow-paths stay out-of-line) was ~10% of the no-inline attrparse profile. Canonical CI bench: ~30-45 ns/doc on the attr-dense shape.
|
|
8
|
+
|
|
9
|
+
## Benchmarks
|
|
10
|
+
|
|
11
|
+
- **The attrparse row is CI-gated and platform-split.** `bench_append_attr_pugixml` now runs in the Benchmark workflow on quiet GH runners (Release + LTO, min of 5) with a new ubuntu-24.04-arm leg. First gated rows: macos-latest **1.11x win** (1830.8 vs 2036.6 ns/doc); ubuntu-24.04-arm 1.13x behind (gcc-13 + glibc, mild); ubuntu-latest x86-64 1.46x behind — the extra ~30% is isolated as **x86-64-specific codegen of the fused scanner under gcc-13** (same toolchain family on arm64 is healthy; gcc-16/arm64 builds leptris faster than clang locally). Run-to-run CI variance is ~5-10%; all verdicts sit outside that band.
|
|
12
|
+
- The same run's `bench_parse_ab` names the next parse gaps with CI-gated shape data: text-shape parse 1.6x behind pugixml on macos and 3.3x on ubuntu-x86; documents at ~13MB collapse to 5.1-5.8x behind on macos (the arena reservation sums ~3x the input length — scratch + pristine + text-room are each len-sized). Full ledger in `TODO.max-perf/15` Track D.
|
|
13
|
+
|
|
14
|
+
## Documentation
|
|
15
|
+
|
|
16
|
+
- README's attribute-dense section now reads from CI artifacts with the platform-split table; negative results ledgered so they are not re-attempted (inline 16B SIMD value scan = 20% regression at ~11-byte values; count3 small-doc skip dead-ends into an allocator-bin cliff; the interleaved lane is not faster below the small-doc threshold).
|
|
17
|
+
|
|
3
18
|
## [1.9.415] - 2026-11-10
|
|
4
19
|
## Performance
|
|
5
20
|
|
|
@@ -1084,33 +1084,49 @@ removed by the lane-18 append/attr work)
|
|
|
1084
1084
|
|
|
1085
1085
|
==== Attribute-dense parse+read (vs pugixml) — 2026-11 refresh
|
|
1086
1086
|
|
|
1087
|
-
Numbers from `bench_append_attr_pugixml
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1087
|
+
Numbers from `bench_append_attr_pugixml`, CI-gated since this
|
|
1088
|
+
revision: the bench runs in the Benchmark workflow on quiet GH
|
|
1089
|
+
runners (Release + LTO, min of 5) on ubuntu-latest, ubuntu-24.04-arm,
|
|
1090
|
+
and macos-latest — the rows below are those artifacts, not local
|
|
1091
|
+
runs. The bench's attrparse row is parse + free per document (20k
|
|
1092
|
+
docs, 4 elements x 16 attributes); the local parse+walk+read
|
|
1093
|
+
harness numbers are noted separately.
|
|
1093
1094
|
|
|
1094
1095
|
[cols="2,>1,>1,>1",options="header"]
|
|
1095
1096
|
|===
|
|
1096
|
-
|Benchmark |Leptris |pugixml |Verdict
|
|
1097
|
+
|Benchmark (parse + free, CI-gated) |Leptris |pugixml |Verdict
|
|
1097
1098
|
|
|
1098
|
-
|
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1099
|
+
|macos-latest
|
|
1100
|
+
|1728.6 ns/doc
|
|
1101
|
+
|2182.9 ns/doc
|
|
1102
|
+
|**1.26x faster**
|
|
1102
1103
|
|
|
1103
|
-
|
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
|
1104
|
+
|ubuntu-latest (x86-64, gcc-13)
|
|
1105
|
+
|2798.6 ns/doc
|
|
1106
|
+
|1885.2 ns/doc
|
|
1107
|
+
|1.48x slower — platform anomaly under investigation (TODO.max-perf/15 Track D)
|
|
1107
1108
|
|
|
1108
|
-
|
|
|
1109
|
+
|Door A (skip dup + positions), ubuntu
|
|
1110
|
+
|2572.7 ns/doc
|
|
1111
|
+
|1885.2 ns/doc
|
|
1112
|
+
|1.37x slower
|
|
1113
|
+
|
|
1114
|
+
|Full-window CPU-clock head-to-head, 4M docs (local, LTO both sides)
|
|
1109
1115
|
|5.45 s user
|
|
1110
1116
|
|5.45 s user
|
|
1111
|
-
|
|
1117
|
+
|equal — user-CPU parity
|
|
1112
1118
|
|===
|
|
1113
1119
|
|
|
1120
|
+
Findings carried in `TODO.max-perf/15` Track D (the follow-up arc to
|
|
1121
|
+
#1842): the ubuntu deficit is leptris-specific (pugixml runs FASTER
|
|
1122
|
+
on ubuntu than macos; gcc-16/arm64 builds leptris faster than clang,
|
|
1123
|
+
so the arm64/gcc dimension is healthy — the arm64-ubuntu CI lane
|
|
1124
|
+
splits gcc-13-x86 codegen from glibc); text-shape parse trails
|
|
1125
|
+
pugixml ~1.6x on macos; documents at ~13 MB collapse to ~5x behind
|
|
1126
|
+
(the arena reservation sums ~3x the input length: scratch + pristine
|
|
1127
|
+
+ text room). The dup-table and dup-probe cuts above ship in this
|
|
1128
|
+
revision.
|
|
1129
|
+
|
|
1114
1130
|
==== Recent performance wins (v1.9.410-v1.9.414)
|
|
1115
1131
|
|
|
1116
1132
|
Each release-verified via ABBA with fresh RelWithDebInfo+LTO builds:
|
|
@@ -131,3 +131,110 @@ whole tree to assign ranks (#485 table).
|
|
|
131
131
|
- #1218: arena estimates only ever grow.
|
|
132
132
|
|
|
133
133
|
Refs #1842, serialbench-c#8.
|
|
134
|
+
|
|
135
|
+
## Track D — attr-dense parse+read row (post-#1842 closure, 2026-11-11)
|
|
136
|
+
|
|
137
|
+
The row's CI gate was missing: `bench_append_attr_pugixml` was NOT in
|
|
138
|
+
the benchmark.yml binary list, so the attrparse row had no
|
|
139
|
+
quiet-runner arbiter (the 2026-11-09 numbers were local). NOW WIRED
|
|
140
|
+
(this commit): the binary joins the CI benchmark legs (ubuntu + macos,
|
|
141
|
+
Release + LTO, quiet GH runners). The row's verdict comes from those
|
|
142
|
+
artifacts.
|
|
143
|
+
|
|
144
|
+
Fresh profile (2026-11-11, no-inline attribution, attrparse shape 4x16
|
|
145
|
+
attrs): dp_parse_attrs 37% | dp_add_attr_inline 20% | dup table 10% |
|
|
146
|
+
strlen faces 10% | count3-neon 4.3% | attributes_raw 3.7% | map
|
|
147
|
+
mutex+TLS 2.7% | dp_nul 2%.
|
|
148
|
+
|
|
149
|
+
Cut ledger:
|
|
150
|
+
- [x] dup-table growth x8 -> x2 (16-attr elements no longer pay a
|
|
151
|
+
512B rehash per doc).
|
|
152
|
+
- [x] dup-probe fast path INLINED in dp_add_attr_inline (~30-45
|
|
153
|
+
ns/doc; the per-attr out-of-line call was the cost).
|
|
154
|
+
- [x] REVERTED: inline 16B SIMD value scan (NEON/SSE2) — a 20%
|
|
155
|
+
REGRESSION for the ~11-byte values the shape has: one chunk of
|
|
156
|
+
5x cmpeq + vpadd-ladder movemask loses to the branch-fused
|
|
157
|
+
scalar table loop at short lengths. The 48-byte inline probe
|
|
158
|
+
threshold was already tuned; do not re-attempt below ~64B.
|
|
159
|
+
- [ ] count3 small-doc inline: DEAD END — without the scan the
|
|
160
|
+
arena sizing needs len-derived upper bounds that over-reserve
|
|
161
|
+
~3x and push small-doc arenas into bigger allocator bins
|
|
162
|
+
(the madvise teardown cost the slack floor already fights).
|
|
163
|
+
- [ ] A3d pristine-copy skip for newline-free docs (count3 gains a
|
|
164
|
+
4th counter): PARKED — the declaration's version/encoding
|
|
165
|
+
views BORROW doc->xml_buffer; switching them to the scratch
|
|
166
|
+
needs the borrowed-pointer topology audited first.
|
|
167
|
+
- The interleaved lane (LEPTRIS_IL_MIN=0) is NOT faster on this
|
|
168
|
+
shape (measured; the small-doc threshold stands).
|
|
169
|
+
|
|
170
|
+
Local measurement discipline note: under parallel agent load,
|
|
171
|
+
leptris degrades ~20% while pugixml stays flat (leptris's scratch +
|
|
172
|
+
pristine + arena working set is far more cache-sensitive). Loaded
|
|
173
|
+
ratios are meaningless; the CI artifacts gate this row from here on.
|
|
174
|
+
|
|
175
|
+
## Track D addendum — the first CI-gated numbers (2026-11-11, PR #2001)
|
|
176
|
+
|
|
177
|
+
bench_append_attr_pugixml's first quiet-runner rows SPLIT BY PLATFORM:
|
|
178
|
+
- macos-latest: leptris 1728.6 vs pugixml 2182.9 — leptris 1.26x WIN.
|
|
179
|
+
- ubuntu-latest: leptris 2798.6 vs pugixml 1885.2 — leptris 1.48x LOSS.
|
|
180
|
+
|
|
181
|
+
The ubuntu anomaly is NOT attr-specific: benchmark_parse (tiny/small/
|
|
182
|
+
medium, cold-start) shows pugixml ahead on BOTH legs at 0.52-0.65x
|
|
183
|
+
(macos) but 0.31-0.40x (ubuntu) — the ubuntu factor roughly DOUBLES
|
|
184
|
+
leptris's deficit on every small-parse shape. pugixml is FASTER on
|
|
185
|
+
ubuntu than macos (1885 vs 2183), so runner speed does not explain it.
|
|
186
|
+
|
|
187
|
+
Compiler dimension isolated locally: gcc-16/arm64 builds leptris
|
|
188
|
+
FASTER than clang (1428 vs 1500, same machine, same clang-built
|
|
189
|
+
pugixml dylib) — the arm64/gcc dimension is healthy. The suspect set
|
|
190
|
+
is gcc-13 x86-64 codegen on the fused scanner or a glibc interaction;
|
|
191
|
+
ubuntu-24.04-arm joins the benchmark matrix to split the dimension
|
|
192
|
+
(same gcc-13 + glibc, different arch+codegen).
|
|
193
|
+
|
|
194
|
+
Slack-floor shrink for small docs: DO NOT re-attempt — #1846
|
|
195
|
+
falsified it (the retained pool amortizes the reservation; measured
|
|
196
|
+
0.9743x = negative).
|
|
197
|
+
|
|
198
|
+
## Track D addendum 2 — the three parse-vs-pugixml gaps (CI-gated, 2026-11-11)
|
|
199
|
+
|
|
200
|
+
bench_parse_ab in the same CI run (shape-fair MB/s) splits the parse
|
|
201
|
+
deficit into three NAMED gaps, none attr-specific:
|
|
202
|
+
|
|
203
|
+
1. **Text-shape scanner gap**: text 1.5/5MB = leptris 1290-1322 MB/s
|
|
204
|
+
vs pugixml 2086-2199 (1.6x) on macos; 573-577 vs 1896 (3.3x!) on
|
|
205
|
+
ubuntu. This is Track A's scanner surgery with a platform shape:
|
|
206
|
+
the text-run fused loop is where the ubuntu-x86 codegen collapses.
|
|
207
|
+
2. **The 13MB collapse (macos)**: attr 502->139 MB/s, text 1290->362
|
|
208
|
+
as the doc grows to 13MB (5.1-5.8x behind). The arena reservation
|
|
209
|
+
sums ~3x len (scratch_bytes + pristine_bytes + text_room are EACH
|
|
210
|
+
len-sized, plus elem/attr/slack terms) -> ~40MB reserved + 2
|
|
211
|
+
full memcpys per parse. Levers: drop the pristine copy when the
|
|
212
|
+
input has no newlines (A3d, parked on the borrowed-pointer audit),
|
|
213
|
+
and fold text_room into scratch (text nodes are substrings of the
|
|
214
|
+
scratch; text_room's 64B/node overhead is the only true extra).
|
|
215
|
+
3. **The ubuntu x-factor**: leptris 2798 vs its own macos 1728 on the
|
|
216
|
+
SAME source+flags (62% self-slowdown) while pugixml runs FASTER on
|
|
217
|
+
ubuntu (1885 vs 2183). gcc-16/arm64 local = healthy. The
|
|
218
|
+
ubuntu-24.04-arm CI lane (this PR) splits gcc-13-x86 codegen from
|
|
219
|
+
glibc. Candidate micro-levers once the dimension is known:
|
|
220
|
+
-fno-plt / mmap-threshold pinning (mallopt) / loop restructuring
|
|
221
|
+
where gcc-13 jump-threading bails.
|
|
222
|
+
|
|
223
|
+
## Track D addendum 3 — the ubuntu dimension RESOLVED (2026-11-11, all three CI legs)
|
|
224
|
+
|
|
225
|
+
attrparse rows from the final three-leg CI run (same commit):
|
|
226
|
+
- macos-latest (clang arm64): leptris 1830.8 vs pugixml 2036.6 — WIN 1.11x.
|
|
227
|
+
- ubuntu-24.04-arm (gcc-13 + glibc, arm64): 2091.7 vs 1850.3 — loss 1.13x.
|
|
228
|
+
- ubuntu-latest (gcc-13 + glibc, x86-64): 2793.4 vs 1914.7 — loss 1.46x.
|
|
229
|
+
|
|
230
|
+
Decomposition: gcc-13+glibc on arm64 costs ~0.02-0.2x (mild); the
|
|
231
|
+
EXTRA ~30% penalty is x86-64-SPECIFIC codegen of the fused scanner
|
|
232
|
+
under gcc-13. The lever: gcc-13-x86 scanner codegen (jump-threading /
|
|
233
|
+
register allocation in direct_parse_internal), CI-leg-verified with
|
|
234
|
+
the x86 lane as the gate. pugixml again ran FASTER on ubuntu hardware
|
|
235
|
+
than macos on both linux legs — the hardware/allocator dimension
|
|
236
|
+
favors it; leptris's own linux penalty is the 1.13x arm number.
|
|
237
|
+
|
|
238
|
+
Also note run-to-run variance: the macos attrparse pair measured
|
|
239
|
+
1728/2183 then 1831/2037 across runs (~5-10%) — treat sub-10% CI
|
|
240
|
+
deltas as noise bands; the win/loss verdicts above sit outside them.
|
|
@@ -49,6 +49,16 @@ extern "C" {
|
|
|
49
49
|
/**
|
|
50
50
|
* Parse XML string into document
|
|
51
51
|
*
|
|
52
|
+
* Parsing is EAGER and SYNCHRONOUS: the full node tree is built
|
|
53
|
+
* before the call returns, so the first access costs the same as
|
|
54
|
+
* every later one (verified against the 2026-11-10 benchmark
|
|
55
|
+
* artifact where a no-touch loop was mistaken for deferred
|
|
56
|
+
* construction — the loop never re-entered the parser per
|
|
57
|
+
* iteration). Only two facets stay lazy by design INSIDE the
|
|
58
|
+
* built tree: predefined entity text (& < ...) materializes
|
|
59
|
+
* on first text read, and per-element namespace caches fill on
|
|
60
|
+
* first namespace query.
|
|
61
|
+
*
|
|
52
62
|
* @param xml XML string (must be valid UTF-8)
|
|
53
63
|
* @param length Length of XML string in bytes
|
|
54
64
|
* @param status Output status code (can be NULL)
|
|
@@ -314,8 +314,10 @@ static LEPTRIS_ALWAYS_INLINE unsigned dp_class_after_ws(DParser* p) {
|
|
|
314
314
|
* inline loop. */
|
|
315
315
|
#if defined(__GNUC__)
|
|
316
316
|
# define DP_UNLIKELY(x) __builtin_expect(!!(x), 0)
|
|
317
|
+
# define DP_LIKELY(x) __builtin_expect(!!(x), 1)
|
|
317
318
|
#else
|
|
318
319
|
# define DP_UNLIKELY(x) (x)
|
|
320
|
+
# define DP_LIKELY(x) (x)
|
|
319
321
|
#endif
|
|
320
322
|
/* The name-char mask IS_NAME_CHAR tests, spelled out so the fused
|
|
321
323
|
* attr-name scan can keep the stop byte's FULL chartype class in a
|
|
@@ -544,7 +546,13 @@ static int dp_dup_seen_or_add(DParser* p, uint32_t dh) {
|
|
|
544
546
|
p->attr_dup_mask = 15;
|
|
545
547
|
p->attr_dup_used = 0;
|
|
546
548
|
} else if ((p->attr_dup_used + 1) * 8 >= (p->attr_dup_mask + 1) * 7) {
|
|
547
|
-
|
|
549
|
+
/* ×2 growth (was ×8): a 16-attr element hit the 14-slot
|
|
550
|
+
* threshold inside a 16-slot table, so EVERY such doc paid a
|
|
551
|
+
* 512B alloc + memset + full rehash on its first element, and
|
|
552
|
+
* every later element memset 512B. 32 slots (load ≤50% at 16
|
|
553
|
+
* attrs) keeps the probe at ~1 step; wide elements still grow
|
|
554
|
+
* geometrically. */
|
|
555
|
+
size_t ncap = (p->attr_dup_mask + 1) * 2;
|
|
548
556
|
uint32_t* nt = (uint32_t*)leptris_pool_alloc(
|
|
549
557
|
p->pool, ncap * sizeof(uint32_t));
|
|
550
558
|
if (!nt) return 0;
|
|
@@ -695,10 +703,33 @@ static inline int dp_add_attr_inline(DParser* p, LeptrisElement elem,
|
|
|
695
703
|
* only runs on genuine candidates. First definition wins
|
|
696
704
|
* (libxml2 recover semantics, and the digest's first-wins
|
|
697
705
|
* becomes official); the duplicate never enters the chain, it
|
|
698
|
-
* costs its already-carved slot.
|
|
706
|
+
* costs its already-carved slot.
|
|
707
|
+
*
|
|
708
|
+
* #1842 cut: the steady-state probe is INLINED here — the
|
|
709
|
+
* out-of-line call per attribute cost ~4-6 cycles of
|
|
710
|
+
* call/prologue on the attrparse row (dp_dup_seen_or_add was
|
|
711
|
+
* 10% of the no-inline profile). The table-miss fast path is
|
|
712
|
+
* five loads/stores; alloc/grow falls back to the function. */
|
|
699
713
|
if (!(p->skip_flags & LEPTRIS_PARSE_SKIP_DUP_DETECTION)) {
|
|
700
714
|
int dup = 0;
|
|
701
|
-
|
|
715
|
+
int seen = 0;
|
|
716
|
+
if (DP_LIKELY(p->attr_dup_slots) &&
|
|
717
|
+
DP_LIKELY((p->attr_dup_used + 1) * 8 <
|
|
718
|
+
(p->attr_dup_mask + 1) * 7)) {
|
|
719
|
+
uint32_t dh = name_hash ? name_hash : 1;
|
|
720
|
+
size_t i = dh & p->attr_dup_mask;
|
|
721
|
+
while (p->attr_dup_slots[i]) {
|
|
722
|
+
if (p->attr_dup_slots[i] == dh) { seen = 1; break; }
|
|
723
|
+
i = (i + 1) & p->attr_dup_mask;
|
|
724
|
+
}
|
|
725
|
+
if (!seen) {
|
|
726
|
+
p->attr_dup_slots[i] = dh;
|
|
727
|
+
p->attr_dup_used++;
|
|
728
|
+
}
|
|
729
|
+
} else {
|
|
730
|
+
seen = dp_dup_seen_or_add(p, name_hash);
|
|
731
|
+
}
|
|
732
|
+
if (seen &&
|
|
702
733
|
elem->first_attribute_off != 0) {
|
|
703
734
|
/* hash hit: confirm against the real chain (collision
|
|
704
735
|
* or genuine duplicate) */
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
#include "leptris/error.h"
|
|
7
7
|
|
|
8
8
|
#include <cstring>
|
|
9
|
+
#include <cstdio>
|
|
9
10
|
#include <cstdlib>
|
|
10
11
|
#include <string>
|
|
11
12
|
|
|
@@ -441,6 +442,63 @@ TEST(AttributeNormalization, CleanValuesStayZeroCopy) {
|
|
|
441
442
|
leptris_document_free(doc);
|
|
442
443
|
}
|
|
443
444
|
|
|
445
|
+
/* The attr-value scan runs 16-byte SIMD chunks over the probe window
|
|
446
|
+
* (2016-11-11 #1842 cut): the opposite quote character is ORDINARY
|
|
447
|
+
* value data, and terminator positions must classify identically at
|
|
448
|
+
* every offset across the chunk boundary (bytes 15/16 straddle the
|
|
449
|
+
* SIMD→scalar-tail seam). Pins: opposite quote, boundary terminators,
|
|
450
|
+
* flag bytes adjacent to the terminator, >48-byte memchr tail. */
|
|
451
|
+
namespace {
|
|
452
|
+
void expect_attr(const char* xml, const char* name, const char* want) {
|
|
453
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
454
|
+
LeptrisDocument doc = leptris_parse_string(xml, std::strlen(xml), &st);
|
|
455
|
+
ASSERT_NE(doc, nullptr) << xml;
|
|
456
|
+
LeptrisElement root = leptris_document_root(doc);
|
|
457
|
+
const char* v = leptris_element_attribute(root, name);
|
|
458
|
+
ASSERT_NE(v, nullptr) << xml;
|
|
459
|
+
EXPECT_STREQ(v, want) << xml;
|
|
460
|
+
leptris_document_free(doc);
|
|
461
|
+
}
|
|
462
|
+
} // namespace
|
|
463
|
+
|
|
464
|
+
TEST(AttributeValueScan, OppositeQuoteIsData) {
|
|
465
|
+
expect_attr("<r a='it\"s ok'/>", "a", "it\"s ok");
|
|
466
|
+
expect_attr("<r a=\"it's ok\"/>", "a", "it's ok");
|
|
467
|
+
/* opposite quote inside the SIMD chunk AND at chunk edges */
|
|
468
|
+
expect_attr("<r a='x\"xxxxxxxxxxxxxxxxxxx\"y'/>", "a",
|
|
469
|
+
"x\"xxxxxxxxxxxxxxxxxxx\"y");
|
|
470
|
+
expect_attr("<r a=\"xxxxxxxxxxxxxxxxxxx'y\"/>", "a",
|
|
471
|
+
"xxxxxxxxxxxxxxxxxxx'y");
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
TEST(AttributeValueScan, TerminatorAtChunkBoundary) {
|
|
475
|
+
/* 11 filler bytes put the terminator at value offset 11..17 —
|
|
476
|
+
* spanning the 16-byte SIMD chunk end and the scalar tail. */
|
|
477
|
+
for (int n = 8; n <= 18; n++) {
|
|
478
|
+
char xml[128];
|
|
479
|
+
std::snprintf(xml, sizeof(xml), "<r a='%0*d'/>", n, 0);
|
|
480
|
+
char want[32];
|
|
481
|
+
std::snprintf(want, sizeof(want), "%0*d", n, 0);
|
|
482
|
+
expect_attr(xml, "a", want);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
TEST(AttributeValueScan, FlagByteJustBeforeTerminator) {
|
|
487
|
+
expect_attr("<r a='abc&'/>", "a", "abc&");
|
|
488
|
+
expect_attr("<r a='ab\tc'/>", "a", "ab c");
|
|
489
|
+
expect_attr("<r a='ab&\tc'/>", "a", "ab& c");
|
|
490
|
+
expect_attr("<r a='&tail'/>", "a", "&tail");
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
TEST(AttributeValueScan, LongValueMemchrTail) {
|
|
494
|
+
char xml[512];
|
|
495
|
+
std::snprintf(xml, sizeof(xml),
|
|
496
|
+
"<r a='%0200d&end'/>", 0);
|
|
497
|
+
char want[256];
|
|
498
|
+
std::snprintf(want, sizeof(want), "%0200d&end", 0);
|
|
499
|
+
expect_attr(xml, "a", want);
|
|
500
|
+
}
|
|
501
|
+
|
|
444
502
|
/* Issue #577: a PI in the epilog (after the document element) is
|
|
445
503
|
* valid XML 1.0 — prolog and epilog both allow PIs. A dataless PI
|
|
446
504
|
* additionally exposed a scan bug: the byte after the target name
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
|
|
3
3
|
"name": "leptris",
|
|
4
|
-
"version": "1.9.
|
|
4
|
+
"version": "1.9.416",
|
|
5
5
|
"description": "High-performance XML parser and XPath 1.0 engine in C (libleptris)",
|
|
6
6
|
"homepage": "https://github.com/leptris/leptris",
|
|
7
7
|
"license": "MIT",
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: leptris
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.9.
|
|
4
|
+
version: 1.9.416.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ffi
|