leptris 1.9.412.4-arm-linux → 1.9.414.0-arm-linux

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b086d079a69fd499744bd01077aa3a55604a3cfba6dfefc854d392ff4374e158
4
- data.tar.gz: 41d5ce937ed2b2f3fc5ccf09cbfc65c37f739122561a442a1112425705f5af72
3
+ metadata.gz: 4864527e515d9dcdac57bb5a51886ccd6d094a462013e0e45fc1234220666b2f
4
+ data.tar.gz: dc60156ea72506ec0d46394bc6f8d7be5a49039170d08c6813354ae2a4eaacf3
5
5
  SHA512:
6
- metadata.gz: 6adaf120896e12541cd2c6a6b9a4a9d0b5cf939b3f494f6ee92db2a7c045aa85e29bcae266b3df5261e9bf86b8f32466284dfe75be3d9c239d7718d31286fd7c
7
- data.tar.gz: 22145c6009b478182cb7940a15897a05fe501f6028e27383ea905079769810a718d041e73711202afef9926f754f86d537cc283bf46f7f5dc01d65c80fe98d29
6
+ metadata.gz: e21a19d9dd5f87abe5d0dc557a93c0ca57f10eb4c7a5747442e7bdb9d69fcb6e26416a141274c600d4ab79f78c0026991c1eeeb1dd3a273835c76d1029190980
7
+ data.tar.gz: 8f7f1c41343e2bd3bd4ece424ebbc30124f957654303ce73b45ef5fb75b7c40a7276931dfcf5e7056eaa053e1659f95478a1c8571676eac412f44a401b50af8d
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.412"
11
+ LIBLEPTRIS_VERSION = "1.9.414"
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
@@ -107,9 +107,21 @@ task :compile do
107
107
  u8_prefix = File.join(u8_dir, "prefix")
108
108
  rm_rf(u8_dir)
109
109
  mkdir_p(u8_dir)
110
- fetch_tarball.call(
111
- "https://github.com/JuliaStrings/utf8proc/releases/download/v#{UTF8PROC_VERSION}/utf8proc-#{UTF8PROC_VERSION}.tar.gz",
112
- u8_dir)
110
+ # The releases/download asset URL is a CDN edge path — a stale 504
111
+ # there poisons EVERY CI lane at once (2026-11-08: all 19 lanes died
112
+ # on it while the rest of GitHub stayed healthy). The codeload
113
+ # archive of the same tag serves identical bytes from a different
114
+ # path: try the asset first, fall back when it exhausts its retries.
115
+ begin
116
+ fetch_tarball.call(
117
+ "https://github.com/JuliaStrings/utf8proc/releases/download/v#{UTF8PROC_VERSION}/utf8proc-#{UTF8PROC_VERSION}.tar.gz",
118
+ u8_dir)
119
+ rescue StandardError
120
+ warn "releases/download URL failed — falling back to codeload"
121
+ fetch_tarball.call(
122
+ "https://codeload.github.com/JuliaStrings/utf8proc/tar.gz/refs/tags/v#{UTF8PROC_VERSION}",
123
+ u8_dir)
124
+ end
113
125
  sh "cmake -B #{u8_dir}/build -S #{u8_dir} -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DUTF8PROC_ENABLE_TESTING=OFF"
114
126
  sh "cmake --build #{u8_dir}/build --config Release -j 4"
115
127
  sh "cmake --install #{u8_dir}/build --prefix #{u8_prefix}"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leptris
4
- VERSION = "1.9.412.4"
4
+ VERSION = "1.9.414.0"
5
5
  end
data/lib/libleptris.so CHANGED
Binary file
data/vendor-src/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Sources vendored in this gem (recompile rights; the ruby
2
2
  variant builds them at install via extconf.rb):
3
3
 
4
- - libleptris v1.9.412
4
+ - libleptris v1.9.414
5
5
  - utf8proc v2.11.0
6
6
 
7
7
  Rebuild by hand:
@@ -1,5 +1,25 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.9.414] - 2026-11-08
4
+ ## Performance
5
+
6
+ - **parse: the pool string_cache is lazy** (#1842 A4). direct_parse created a 128-bucket hash table eagerly for every >=256-byte document, but the scanner stores borrowed views and most documents never intern anything through that path — the eager create cost ~70 ns/doc (5.6% of the parse on the attribute-dense attrparse shape, line-level profiled). The intern path now creates the table on first use; the OOM path falls back to direct allocation exactly as before. Users-doc parse +2%, attribute-dense shape +1%, one 128-bucket pool block saved per document.
7
+
8
+ ## Benchmarks
9
+
10
+ - **The attrparse comparison rows are honest now.** They measured parse-WITHOUT-tree-access: pugixml's `load_buffer` parses eagerly while leptris defers until first tree access, so the old rows compared handle-setup against parsing (apples to oranges) under loaded-machine wall timing. The rows now measure parse + walk + read every attribute name and value on BOTH engines with a min-of-5-reps statistic — on this machine leptris ~1600 ns/doc vs pugixml ~1420, and the CPU-clock head-to-head with the tree walk shows parity (the previously reported 2.0x deficit was the methodology artifact; full post-mortem on #1842).
11
+
12
+ ## [1.9.413] - 2026-11-08
13
+ ## Performance
14
+
15
+ - **parse: the loop-invariant parser fields hoisted to const locals** (#1842 A4 slice 1). The main parse loop read `line_offsets_ok` / `drop_ws_text` / `keep_entity_refs` / `recover` from the parser struct per node — all written once before the loop, but un-hoistable by the compiler across the parser-pointer-taking callees, so every node paid memory loads. ABBA x6 on the parse-only scoreboard shape: **+3.5% median parse, 9/9 pairs positive**. Suite 2250/2250.
16
+
17
+ ## Documentation
18
+
19
+ - A4 function-level inventory: the tokenizer's remaining arc precisely scoped (dispatch own body ~39%, text scan already 25% SIMD, wiring near-optimal) — the roadmap for the next parse slices.
20
+
21
+ ## [1.9.412] - 2026-11-07
22
+
3
23
  ## Changed
4
24
 
5
25
  - **XPath: `//a | //b` fuses to one doc-ordered pass** (#1842 Track C lever 2). The scoreboard's first XPath query shape (serialbench-c bench.c:104) compiled to two fused descendant walks plus the generic union operator — per-eval concatenation then an O(n log n) doc-order sort. Both bare plain-name descendant branches now compile to one `XPATH_BC_ABSOLUTE_UNION_NAMES` opcode: one combined pre-order walk when the element index is not yet built, an O(n+m) two-pointer merge over the parse-offset keys once it is, and a single bucket copy for same-name unions. Wildcards, prefixed names, predicates, and deep branches stay on the generic path. Measured (ABBA x6, fresh RelWithDebInfo+LTO builds, serialbench medium.xml): union-only shape +8.5%, full scoreboard row (parse + 3 canonical queries) **888 → 945 ops/s (+6.4%)**, all pairs positive. Seven new `XPathUnionFusion` pins, including the interleaved-layout document-order trap a branch-concatenation would get wrong.
@@ -3,7 +3,7 @@
3
3
  cmake_minimum_required(VERSION 3.20)
4
4
 
5
5
  project(leptris
6
- VERSION 1.9.412
6
+ VERSION 1.9.414
7
7
  DESCRIPTION "Fast XML parser and XPath evaluator in pure C"
8
8
  LANGUAGES C CXX
9
9
  )
@@ -110,6 +110,18 @@ whole tree to assign ranks (#485 table).
110
110
  LTO behavior on gcc-win vs clang-mac?) and port whatever
111
111
  wins back to the other legs.
112
112
 
113
+ **A4 INVENTORY COMPLETE (2026-11-07, non-LTO function-level
114
+ profile, parse-only scoreboard shape)**: tokenizer own body
115
+ ~39% (the arc itself — char dispatch + element-open/close),
116
+ NEON text scan ~25% (already SIMD; residual = loop overhead
117
+ + scalar tails), dp_wire_child ~15% (branchless, memory-bound
118
+ — near-optimal), dp_text_create 6.3% (carved, lean), pos
119
+ journal 2.8%. Named sub-levers in the element-open region:
120
+ dp_parse_attrs call site (~1300), the source-position gate +
121
+ record (~600), the close-tag scan (dp_scan_name NOT fused —
122
+ a bounded fusion lever ~300). Evidence: #1842 comment
123
+ (function-level table).
124
+
113
125
  ## Laws
114
126
 
115
127
  - CI benchmark legs (quiet runners) gate every number; local A/B
@@ -15,6 +15,8 @@ static double now_ns() {
15
15
  }
16
16
 
17
17
  int main(void) {
18
+ volatile size_t sink = 0;
19
+ (void)sink;
18
20
  const int N_APPEND = 200000;
19
21
  const int N_PARSE = 20000;
20
22
 
@@ -106,46 +108,104 @@ int main(void) {
106
108
  xml += "/>";
107
109
  }
108
110
  xml += "</r>";
111
+ /* #1842 attr-parse methodology (corrected 2026-11-09): the old
112
+ * rows measured parse-without-access — apples to oranges, since
113
+ * pugixml's load_buffer parses EAGERLY while leptris defers
114
+ * until first tree access (the no-access loop completed at
115
+ * handle-setup cost and the row compared setup vs parse). The
116
+ * honest workload: parse + walk + read every attribute name and
117
+ * value on BOTH engines. Statistic: MIN of 5 repetitions — the
118
+ * standard noise-robust estimator for microbenchmarks (max
119
+ * responsiveness, min scheduler noise). */
109
120
  {
110
- double t0 = now_ns();
111
- for (int i = 0; i < N_PARSE; i++) {
112
- LeptrisDocument d =
113
- leptris_parse_string(xml.data(), xml.size(), NULL);
114
- leptris_document_free(d);
115
- }
116
- double t1 = now_ns();
117
- printf("attrparse leptris: %7.1f ns/doc (%zu bytes)\n",
118
- (t1 - t0) / N_PARSE, xml.size());
119
- }
120
- {
121
- /* Door A (leptris#1436, shipped v1.9.272): the opt-in fast
122
- * path — duplicate detection and source positions off. The
123
- * default row above carries full conformance work pugixml
124
- * does none of; this row shows the speed callers can opt
125
- * into when their pipeline guarantees uniqueness and skips
126
- * position reporting. */
127
- LeptrisParseFlags flags = static_cast<LeptrisParseFlags>(
128
- LEPTRIS_PARSE_SKIP_DUP_DETECTION |
129
- LEPTRIS_PARSE_SKIP_SOURCE_POSITIONS);
130
- double t0 = now_ns();
131
- for (int i = 0; i < N_PARSE; i++) {
132
- LeptrisDocument d = leptris_parse_string_flags(
133
- xml.data(), xml.size(), flags, NULL);
134
- leptris_document_free(d);
135
- }
136
- double t1 = now_ns();
137
- printf("attrparse leptris+flags: %7.1f ns/doc (Door A)\n",
138
- (t1 - t0) / N_PARSE);
139
- }
140
- {
141
- double t0 = now_ns();
142
- for (int i = 0; i < N_PARSE; i++) {
143
- pugi::xml_document d;
144
- d.load_buffer((void*)xml.data(), xml.size());
121
+ const int REPS = 5;
122
+ double best_lx = 1e18, best_lx_a = 1e18, best_pugi = 1e18;
123
+ for (int rep = 0; rep < REPS; rep++) {
124
+ {
125
+ double t0 = now_ns();
126
+ for (int i = 0; i < N_PARSE; i++) {
127
+ LeptrisDocument d = leptris_parse_string(
128
+ xml.data(), xml.size(), NULL);
129
+ if (!d) return 4;
130
+ LeptrisElement r = leptris_document_root(d);
131
+ if (!r) return 5;
132
+ for (LeptrisElement c =
133
+ leptris_element_first_child_any(r);
134
+ c;
135
+ c = leptris_element_next_sibling_any(c)) {
136
+ const char* names[32]; const char* vals[32];
137
+ size_t na = leptris_element_attributes_raw(
138
+ c, names, vals, 32);
139
+ for (size_t k = 0; k < na; k++) {
140
+ sink += strlen(names[k]);
141
+ sink += strlen(vals[k]);
142
+ }
143
+ }
144
+ leptris_document_free(d);
145
+ }
146
+ double t1 = now_ns();
147
+ double ns = (t1 - t0) / N_PARSE;
148
+ if (ns < best_lx) best_lx = ns;
149
+ }
150
+ {
151
+ /* Door A (leptris#1436, shipped v1.9.272): the opt-in
152
+ * fast path — duplicate detection and source positions
153
+ * off. Full conformance work pugixml does none of. */
154
+ LeptrisParseFlags flags = static_cast<LeptrisParseFlags>(
155
+ LEPTRIS_PARSE_SKIP_DUP_DETECTION |
156
+ LEPTRIS_PARSE_SKIP_SOURCE_POSITIONS);
157
+ double t0 = now_ns();
158
+ for (int i = 0; i < N_PARSE; i++) {
159
+ LeptrisDocument d = leptris_parse_string_flags(
160
+ xml.data(), xml.size(), flags, NULL);
161
+ if (!d) return 6;
162
+ LeptrisElement r = leptris_document_root(d);
163
+ if (!r) return 7;
164
+ for (LeptrisElement c =
165
+ leptris_element_first_child_any(r);
166
+ c;
167
+ c = leptris_element_next_sibling_any(c)) {
168
+ const char* names[32]; const char* vals[32];
169
+ size_t na = leptris_element_attributes_raw(
170
+ c, names, vals, 32);
171
+ for (size_t k = 0; k < na; k++) {
172
+ sink += strlen(names[k]);
173
+ sink += strlen(vals[k]);
174
+ }
175
+ }
176
+ leptris_document_free(d);
177
+ }
178
+ double t1 = now_ns();
179
+ double ns = (t1 - t0) / N_PARSE;
180
+ if (ns < best_lx_a) best_lx_a = ns;
181
+ }
182
+ {
183
+ double t0 = now_ns();
184
+ for (int i = 0; i < N_PARSE; i++) {
185
+ pugi::xml_document d;
186
+ pugi::xml_parse_result res =
187
+ d.load_buffer((void*)xml.data(), xml.size());
188
+ if (!res) return 8;
189
+ for (pugi::xml_node c = d.first_child().first_child();
190
+ c; c = c.next_sibling()) {
191
+ for (pugi::xml_attribute a = c.first_attribute();
192
+ a; a = a.next_attribute()) {
193
+ sink += strlen(a.name());
194
+ sink += strlen(a.value());
195
+ }
196
+ }
197
+ }
198
+ double t1 = now_ns();
199
+ double ns = (t1 - t0) / N_PARSE;
200
+ if (ns < best_pugi) best_pugi = ns;
201
+ }
145
202
  }
146
- double t1 = now_ns();
147
- printf("attrparse pugixml: %7.1f ns/doc\n",
148
- (t1 - t0) / N_PARSE);
203
+ printf("attrparse leptris: %7.1f ns/doc (%zu bytes, min of %d)\n",
204
+ best_lx, xml.size(), REPS);
205
+ printf("attrparse leptris+flags: %7.1f ns/doc (Door A, min of %d)\n",
206
+ best_lx_a, REPS);
207
+ printf("attrparse pugixml: %7.1f ns/doc (min of %d)\n",
208
+ best_pugi, REPS);
149
209
  }
150
210
  return 0;
151
211
  }
@@ -1568,10 +1568,6 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
1568
1568
  leptris_arena_destroy(arena);
1569
1569
  return NULL;
1570
1570
  }
1571
- if (len >= 256) {
1572
- pool->string_cache = leptris_hash_table_create(pool, 128);
1573
- }
1574
-
1575
1571
  /* Round 8 carve: scratch first, then the pristine copy for
1576
1572
  * const inputs — the first pool bumps, so the scanner's buffers
1577
1573
  * sit at the front of the document-owned span. doc_free skips
@@ -1743,6 +1739,18 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
1743
1739
  p.pos += 3;
1744
1740
  }
1745
1741
 
1742
+ /* #1842 A4 slice: the loop-invariant DParser fields hoisted to
1743
+ * const locals — written once above, never inside the loop, but
1744
+ * every per-node read pays a memory load because the compiler
1745
+ * cannot prove the DParser*-taking callees (dp_parse_attrs and
1746
+ * friends) never store through p. The A4 parse profile's
1747
+ * dispatch stubs carry those loads. */
1748
+ const int ho_line_offsets_ok = p.line_offsets_ok;
1749
+ const int ho_drop_ws_text = p.drop_ws_text;
1750
+ const int ho_keep_entity_refs = p.keep_entity_refs;
1751
+ const int ho_recover = p.recover;
1752
+ #define P_LINE_OFFSETS_OK line_offsets_ok
1753
+ (void)ho_drop_ws_text; (void)ho_keep_entity_refs; (void)ho_recover;
1746
1754
  while (p.pos < p.end) {
1747
1755
  /* Top-level whitespace: a TEXT child of the document node —
1748
1756
  * chained like prolog comments/PIs so /node() counts it and
@@ -1776,7 +1784,7 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
1776
1784
  * dropped only when every byte up to the next markup
1777
1785
  * delimiter is whitespace; otherwise the text path sees
1778
1786
  * the leading whitespace untouched. */
1779
- if (p.drop_ws_text &&
1787
+ if (ho_drop_ws_text &&
1780
1788
  (*p.pos == ' ' || *p.pos == '\t' || *p.pos == '\n' ||
1781
1789
  *p.pos == '\r')) {
1782
1790
  char* q = p.pos + 1;
@@ -1798,7 +1806,7 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
1798
1806
  * [text_start, lt) only. */
1799
1807
  char* text_start = p.pos;
1800
1808
  uint32_t text_off =
1801
- p.line_offsets_ok
1809
+ ho_line_offsets_ok
1802
1810
  ? (uint32_t)(text_start - p.buf) + 1u : 0u;
1803
1811
  char* lt = NULL;
1804
1812
  int has_amp = 0;
@@ -1847,7 +1855,7 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
1847
1855
 
1848
1856
  if (tlen == 0) continue;
1849
1857
  /* (ws handling lives at the text-branch ENTRY — see the
1850
- * drop_ws_text fast path before text_start.) */
1858
+ * ho_drop_ws_text fast path before text_start.) */
1851
1859
  if (p.depth == 0) {
1852
1860
  /* Whitespace-only between root and PIs. */
1853
1861
  for (char* c = text_start; c < p.pos; c++) {
@@ -1866,7 +1874,7 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
1866
1874
  * character references still expand lazily on read);
1867
1875
  * named references become ENTITY_REF nodes. A '&' that
1868
1876
  * is not a well-formed reference stays literal text. */
1869
- if (p.keep_entity_refs && has_amp) {
1877
+ if (ho_keep_entity_refs && has_amp) {
1870
1878
  const char* seg = text_start;
1871
1879
  const char* tq = text_start;
1872
1880
  const char* t_end = text_start + tlen;
@@ -2011,7 +2019,7 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
2011
2019
  if (IS_NAME_START(next)) {
2012
2020
  /* Element. Snapshot line BEFORE scanning the open tag so
2013
2021
  * the element reports the line where '<' appeared. */
2014
- uint32_t elem_off = p.line_offsets_ok
2022
+ uint32_t elem_off = ho_line_offsets_ok
2015
2023
  ? (uint32_t)(p.pos - p.buf) + 1u : 0u;
2016
2024
  LeptrisElement elem;
2017
2025
  if (elem_idx < est_elems) {
@@ -2065,7 +2073,7 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
2065
2073
  /* Parse attributes (scans from the delimiter position). */
2066
2074
  int self_closing = dp_parse_attrs(&p, elem);
2067
2075
  if (self_closing < 0) goto fail;
2068
- if (p.line_offsets_ok &&
2076
+ if (ho_line_offsets_ok &&
2069
2077
  !(p.skip_flags & LEPTRIS_PARSE_SKIP_SOURCE_POSITIONS)) {
2070
2078
  uint32_t ste = (uint32_t)(p.pos - p.buf);
2071
2079
  p.pos_slot_stack[p.depth] = leptris_elem_pos_record(
@@ -2248,7 +2256,7 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
2248
2256
  "Element %s closed implicitly by </%.*s>",
2249
2257
  elem_name(ce),
2250
2258
  (int)close_local_len, close_local);
2251
- if (p.line_offsets_ok) {
2259
+ if (ho_line_offsets_ok) {
2252
2260
  leptris_elem_pos_close_at(
2253
2261
  p.doc,
2254
2262
  p.pos_slot_stack[p.depth - 1],
@@ -2270,7 +2278,7 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
2270
2278
  }
2271
2279
  }
2272
2280
  close_matched:
2273
- if (p.line_offsets_ok) {
2281
+ if (ho_line_offsets_ok) {
2274
2282
  /* Round 10: fill the open element's journal slot in
2275
2283
  * place — no hash probe, and the recorded start offset
2276
2284
  * survives verbatim. open_stack[p.depth-1] is `open`;
@@ -2288,7 +2296,7 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
2288
2296
  }
2289
2297
  else if (next == '!') {
2290
2298
  /* Comment, CDATA, or DOCTYPE. */
2291
- uint32_t markup_off = p.line_offsets_ok
2299
+ uint32_t markup_off = ho_line_offsets_ok
2292
2300
  ? (uint32_t)(p.pos - p.buf) + 1u : 0u;
2293
2301
  if (p.end - p.pos >= 4 && p.pos[2] == '-' && p.pos[3] == '-') {
2294
2302
  /* Comment: <!-- ... --> */
@@ -2378,7 +2386,7 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
2378
2386
  }
2379
2387
  else if (next == '?') {
2380
2388
  /* PI: <?target data?> or XML declaration. */
2381
- uint32_t pi_off = p.line_offsets_ok
2389
+ uint32_t pi_off = ho_line_offsets_ok
2382
2390
  ? (uint32_t)(p.pos - p.buf) + 1u : 0u;
2383
2391
  p.pos += 2;
2384
2392
  char* target_start = p.pos;
@@ -2493,7 +2501,7 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
2493
2501
  LEPTRIS_DIAG_UNCLOSED_ELEMENT, NULL,
2494
2502
  "Element %s still open at end of document",
2495
2503
  elem_name(ce));
2496
- if (p.line_offsets_ok) {
2504
+ if (ho_line_offsets_ok) {
2497
2505
  leptris_elem_pos_close_at(
2498
2506
  p.doc, p.pos_slot_stack[p.depth - 1],
2499
2507
  (uint32_t)(p.pos - p.buf));
@@ -780,13 +780,23 @@ char* leptris_pool_intern_string(LeptrisMemoryPool* pool, const LeptrisStringVie
780
780
  return NULL;
781
781
  }
782
782
 
783
- /* If no hash table, fall back to direct allocation (no deduplication) */
783
+ /* The table is created LAZILY on the first intern (#1842 A4):
784
+ * direct_parse created a 128-bucket table eagerly for every
785
+ * >=256-byte document, but the scanner stores borrowed views and
786
+ * most documents never intern anything through this path — the
787
+ * eager create cost ~70 ns/doc on the attrparse shape (5.6% of
788
+ * the parse, line-level profiled). Callers that intern pay the
789
+ * create once, on first use. */
784
790
  if (!pool->string_cache) {
785
- char* str = (char*)leptris_pool_alloc(pool, sv->length + 1);
786
- if (!str) return NULL;
787
- memcpy(str, sv->data, sv->length);
788
- str[sv->length] = '\0';
789
- return str;
791
+ pool->string_cache = leptris_hash_table_create(pool, 128);
792
+ if (!pool->string_cache) {
793
+ /* cold-path OOM: fall back to direct allocation */
794
+ char* str = (char*)leptris_pool_alloc(pool, sv->length + 1);
795
+ if (!str) return NULL;
796
+ memcpy(str, sv->data, sv->length);
797
+ str[sv->length] = '\0';
798
+ return str;
799
+ }
790
800
  }
791
801
 
792
802
  StringHashTable* table = pool->string_cache;
@@ -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.412",
4
+ "version": "1.9.414",
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.412.4
4
+ version: 1.9.414.0
5
5
  platform: arm-linux
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-07 00:00:00.000000000 Z
11
+ date: 2026-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi