leptris 1.9.420.3-arm-linux → 1.9.421.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 +4 -4
- data/Rakefile +1 -1
- data/lib/leptris/version.rb +1 -1
- data/lib/libleptris.so +0 -0
- data/vendor-src/README.md +1 -1
- data/vendor-src/libleptris/CHANGELOG.md +11 -0
- data/vendor-src/libleptris/CMakeLists.txt +1 -1
- data/vendor-src/libleptris/src/leptris/common/simd_text.c +34 -0
- data/vendor-src/libleptris/src/leptris/common/simd_text.h +16 -0
- data/vendor-src/libleptris/src/leptris/common/simd_text_avx2.c +34 -1
- data/vendor-src/libleptris/src/leptris/common/simd_text_neon.c +31 -0
- data/vendor-src/libleptris/src/leptris/flat/direct_parse.c +14 -3
- data/vendor-src/libleptris/test/parser/test_parser.cpp +22 -0
- data/vendor-src/libleptris/vcpkg.json +1 -1
- 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: 0bc10dde1df0dc4bda566ef868c728031c302efea5ab315525a6e86133f80ace
|
|
4
|
+
data.tar.gz: 42a5e27e7176b2247206ce06fe8e6c316ddd2c734ef93f2d6fe1d4600a7f3409
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bdda1e3f6391bd7ccaa919f9815e96c195a4604218298eed1dbde046a659ad3f4ce90e1fa5a67ce60e2f0aac79d75fb7a38a82f59891934cf1d354e46a81c404
|
|
7
|
+
data.tar.gz: a76d4b709ead39d7b688cda95cade4831ba7a9dc4feb4d4d5aa59d300a4a53f70c3a651f3f42afe2f233ce3259e3f91c6b59d1131aeb01a530027fa54ebe9e96
|
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.421"
|
|
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
|
data/lib/leptris/version.rb
CHANGED
data/lib/libleptris.so
CHANGED
|
Binary file
|
data/vendor-src/README.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [1.9.421] - 2026-11-15
|
|
4
|
+
### Performance
|
|
5
|
+
|
|
6
|
+
- **text: the census-gated pristine scan** (leptris#2033 round 2). The `count3_high` sizing pre-scan already counts `&` and tab/LF/CR for the whole buffer — a document with both counts zero has *provably constant* scan flags, so the text branch dispatches to a term-only kernel (`leptris_text_scan_run_pristine`, NEON/AVX2/scalar) whose vector loop carries only the term compare: the f1/f2 accumulator chains drop out entirely, and the round-1 rescan penalty cannot occur because the census already answered the flags. Gate teeth: a DTD custom entity requires the eager entity path (routed by the scan's has_amp flag — the lazy read cannot resolve custom entities), and the new pin fails when the gate is forced open. Local interleaved A/B on the pristine-class 13MB text shape: median +10%.
|
|
7
|
+
|
|
8
|
+
### CI
|
|
9
|
+
|
|
10
|
+
- **perf-gate: the configure stage installs `libutf8proc-dev`** — the gate had errored without measuring since Nov 13, when the runner-image update (20261111.370) removed the runner copy of utf8proc the gate had been implicitly relying on (found during the release audit).
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
3
14
|
## [1.9.420] - 2026-11-13
|
|
4
15
|
### Fixed
|
|
5
16
|
|
|
@@ -321,6 +321,40 @@ ptrdiff_t leptris_text_scan_run(const char* s, size_t len, char term,
|
|
|
321
321
|
return g_scan_run_fn(s, len, term, f1, f2, saw_f1, saw_f2);
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
+
/* leptris#2033 round 2: the census-gated term-only scan. For
|
|
325
|
+
* documents whose count3_high pre-scan proved zero '&' and zero
|
|
326
|
+
* tab/LF/CR, the f1/f2 accumulator chains are dead weight — the
|
|
327
|
+
* flags are constant 0 by census, so the vector loop carries ONLY
|
|
328
|
+
* the term compare and the no-term tail returns immediately (the
|
|
329
|
+
* round-1 rescan penalty cannot occur: the census answered the
|
|
330
|
+
* flags). Arch kernels live in their own TUs, dispatched like
|
|
331
|
+
* text_scan_run. */
|
|
332
|
+
ptrdiff_t leptris_text_scan_run_pristine(const char* s, size_t len,
|
|
333
|
+
char term,
|
|
334
|
+
int* saw_f1, int* saw_f2) {
|
|
335
|
+
#if defined(LEPTRIS_ARCH_ARM) && defined(__aarch64__)
|
|
336
|
+
return leptris_text_scan_run_pristine_neon(s, len, term,
|
|
337
|
+
saw_f1, saw_f2);
|
|
338
|
+
#elif defined(LEPTRIS_ARCH_X86) && defined(LEPTRIS_HAS_AVX2_BUILD)
|
|
339
|
+
return leptris_text_scan_run_pristine_avx2(s, len, term,
|
|
340
|
+
saw_f1, saw_f2);
|
|
341
|
+
#else
|
|
342
|
+
const char* p = s;
|
|
343
|
+
const char* end = s + len;
|
|
344
|
+
while (p < end) {
|
|
345
|
+
if (*p == term) {
|
|
346
|
+
*saw_f1 = 0;
|
|
347
|
+
*saw_f2 = 0;
|
|
348
|
+
return (ptrdiff_t)(p - s);
|
|
349
|
+
}
|
|
350
|
+
p++;
|
|
351
|
+
}
|
|
352
|
+
*saw_f1 = 0;
|
|
353
|
+
*saw_f2 = 0;
|
|
354
|
+
return -1;
|
|
355
|
+
#endif
|
|
356
|
+
}
|
|
357
|
+
|
|
324
358
|
/* ---- Structural span scan (TODO 193 Phase 1) ---- */
|
|
325
359
|
|
|
326
360
|
unsigned char leptris_dp_class_table[256];
|
|
@@ -98,6 +98,22 @@ ptrdiff_t leptris_text_scan_run(const char* s, size_t len, char term,
|
|
|
98
98
|
char f1, char f2,
|
|
99
99
|
int* saw_f1, int* saw_f2);
|
|
100
100
|
|
|
101
|
+
/* The census-gated variant (leptris#2033 round 2): identical
|
|
102
|
+
* contract, for documents whose pre-scan census proved ZERO '&' and
|
|
103
|
+
* zero tab/LF/CR bytes anywhere — the flags are constant 0 and the
|
|
104
|
+
* accumulator chains drop out of the loop. saw_f1/saw_f2 are
|
|
105
|
+
* WRITTEN as 0 (callers read them unconditionally). */
|
|
106
|
+
ptrdiff_t leptris_text_scan_run_pristine(const char* s, size_t len,
|
|
107
|
+
char term,
|
|
108
|
+
int* saw_f1, int* saw_f2);
|
|
109
|
+
|
|
110
|
+
ptrdiff_t leptris_text_scan_run_pristine_neon(const char* s, size_t len,
|
|
111
|
+
char term,
|
|
112
|
+
int* saw_f1, int* saw_f2);
|
|
113
|
+
ptrdiff_t leptris_text_scan_run_pristine_avx2(const char* s, size_t len,
|
|
114
|
+
char term,
|
|
115
|
+
int* saw_f1, int* saw_f2);
|
|
116
|
+
|
|
101
117
|
/* ---- Structural span scan (TODO 193 Phase 1: parser v3) ----
|
|
102
118
|
*
|
|
103
119
|
* Records every byte of the XML structural set in [buf, buf+len)
|
|
@@ -370,4 +370,37 @@ int leptris_utf8_valid_avx2(const char* src, size_t len) {
|
|
|
370
370
|
if (b >= 0xC2 && b <= 0xF4) start--;
|
|
371
371
|
}
|
|
372
372
|
return leptris_utf8_valid_scalar((const char*)(p + start), len - start);
|
|
373
|
-
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/* leptris#2033 round 2: the census-gated term-only scan — no
|
|
376
|
+
* accumulator chains (the census proved the flags constant 0). */
|
|
377
|
+
ptrdiff_t leptris_text_scan_run_pristine_avx2(const char* s, size_t len,
|
|
378
|
+
char term,
|
|
379
|
+
int* saw_f1, int* saw_f2) {
|
|
380
|
+
const char* p = s;
|
|
381
|
+
const char* end = s + len;
|
|
382
|
+
const __m256i kt = _mm256_set1_epi8(term);
|
|
383
|
+
while (end - p >= 32) {
|
|
384
|
+
__m256i v = _mm256_loadu_si256((const __m256i*)p);
|
|
385
|
+
uint32_t mt =
|
|
386
|
+
(uint32_t)_mm256_movemask_epi8(_mm256_cmpeq_epi8(v, kt));
|
|
387
|
+
if (mt) {
|
|
388
|
+
unsigned idx = (unsigned)LEPTRIS_CTZ(mt);
|
|
389
|
+
*saw_f1 = 0;
|
|
390
|
+
*saw_f2 = 0;
|
|
391
|
+
return (ptrdiff_t)(p + idx - s);
|
|
392
|
+
}
|
|
393
|
+
p += 32;
|
|
394
|
+
}
|
|
395
|
+
while (p < end) {
|
|
396
|
+
if (*p == term) {
|
|
397
|
+
*saw_f1 = 0;
|
|
398
|
+
*saw_f2 = 0;
|
|
399
|
+
return (ptrdiff_t)(p - s);
|
|
400
|
+
}
|
|
401
|
+
p++;
|
|
402
|
+
}
|
|
403
|
+
*saw_f1 = 0;
|
|
404
|
+
*saw_f2 = 0;
|
|
405
|
+
return -1;
|
|
406
|
+
}
|
|
@@ -523,3 +523,34 @@ int leptris_utf8_valid_neon(const char* src, size_t len) {
|
|
|
523
523
|
return leptris_utf8_valid_scalar((const char*)(p + start), len - start);
|
|
524
524
|
}
|
|
525
525
|
#undef IN_RANGE
|
|
526
|
+
|
|
527
|
+
/* leptris#2033 round 2: the census-gated term-only scan — no
|
|
528
|
+
* accumulator chains (the census proved the flags constant 0). */
|
|
529
|
+
ptrdiff_t leptris_text_scan_run_pristine_neon(const char* s, size_t len,
|
|
530
|
+
char term,
|
|
531
|
+
int* saw_f1, int* saw_f2) {
|
|
532
|
+
const char* p = s;
|
|
533
|
+
const char* end = s + len;
|
|
534
|
+
const uint8x16_t kt = vdupq_n_u8((uint8_t)term);
|
|
535
|
+
while (end - p >= 16) {
|
|
536
|
+
if (vmaxvq_u8(vceqq_u8(vld1q_u8((const uint8_t*)p), kt)) != 0) {
|
|
537
|
+
int i = 0;
|
|
538
|
+
while (p[i] != term) i++;
|
|
539
|
+
*saw_f1 = 0;
|
|
540
|
+
*saw_f2 = 0;
|
|
541
|
+
return (ptrdiff_t)(p + i - s);
|
|
542
|
+
}
|
|
543
|
+
p += 16;
|
|
544
|
+
}
|
|
545
|
+
while (p < end) {
|
|
546
|
+
if (*p == term) {
|
|
547
|
+
*saw_f1 = 0;
|
|
548
|
+
*saw_f2 = 0;
|
|
549
|
+
return (ptrdiff_t)(p - s);
|
|
550
|
+
}
|
|
551
|
+
p++;
|
|
552
|
+
}
|
|
553
|
+
*saw_f1 = 0;
|
|
554
|
+
*saw_f2 = 0;
|
|
555
|
+
return -1;
|
|
556
|
+
}
|
|
@@ -1574,6 +1574,12 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
|
|
|
1574
1574
|
* structural use (pretty-printed docs) conservatively re-arms
|
|
1575
1575
|
* it, and CR-only line endings keep it armed. */
|
|
1576
1576
|
int has_copy_sources = (amp_count_in != 0 || valws_count_in != 0);
|
|
1577
|
+
/* leptris#2033 round 2: the census proved zero '&' and zero
|
|
1578
|
+
* tab/LF/CR in the whole buffer — text runs cannot carry the
|
|
1579
|
+
* f1/f2 flags, so the term-only kernel drops the accumulator
|
|
1580
|
+
* chains. The entity/CR branches downstream are unreachable on
|
|
1581
|
+
* this class by the same census. */
|
|
1582
|
+
int pristine_text = (amp_count_in == 0 && valws_count_in == 0);
|
|
1577
1583
|
/* Track D A3d: the pristine copy exists so doc->xml_buffer stays
|
|
1578
1584
|
* byte-identical to the input — the lazy line table (#223)
|
|
1579
1585
|
* counts '\n' against it, and dp_nul may clobber a newline that
|
|
@@ -1902,9 +1908,14 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
|
|
|
1902
1908
|
int has_cr = 0;
|
|
1903
1909
|
{
|
|
1904
1910
|
int saw_amp = 0, saw_cr = 0;
|
|
1905
|
-
ptrdiff_t t_off =
|
|
1906
|
-
|
|
1907
|
-
|
|
1911
|
+
ptrdiff_t t_off =
|
|
1912
|
+
pristine_text
|
|
1913
|
+
? leptris_text_scan_run_pristine(
|
|
1914
|
+
p.pos, (size_t)(p.end - p.pos), '<',
|
|
1915
|
+
&saw_amp, &saw_cr)
|
|
1916
|
+
: leptris_text_scan_run(
|
|
1917
|
+
p.pos, (size_t)(p.end - p.pos), '<', '&',
|
|
1918
|
+
'\r', &saw_amp, &saw_cr);
|
|
1908
1919
|
lt = (t_off >= 0) ? (char*)(p.pos + t_off) : NULL;
|
|
1909
1920
|
has_amp |= saw_amp;
|
|
1910
1921
|
has_cr |= saw_cr;
|
|
@@ -1064,3 +1064,25 @@ TEST(RoundTrip, OoxmlRunPropertiesKeepValAttributes) {
|
|
|
1064
1064
|
leptris_free_string(out);
|
|
1065
1065
|
leptris_document_free(doc);
|
|
1066
1066
|
}
|
|
1067
|
+
|
|
1068
|
+
/* leptris#2033 round 2 gate teeth: a DTD custom entity requires the
|
|
1069
|
+
* EAGER entity path (the lazy read cannot resolve custom entities),
|
|
1070
|
+
* routed by the text scan's has_amp flag. The census-gated
|
|
1071
|
+
* pristine-text kernel must NEVER take a document whose census
|
|
1072
|
+
* counts '&' — forcing it leaves the entity reference raw. */
|
|
1073
|
+
TEST(Parser, DtdCustomEntityExpandsThroughTheEagerPath) {
|
|
1074
|
+
const char* xml =
|
|
1075
|
+
"<!DOCTYPE r [<!ENTITY x \"hello\">]><r>&x; world</r>";
|
|
1076
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
1077
|
+
LeptrisDocument doc =
|
|
1078
|
+
leptris_parse_string(xml, std::strlen(xml), &st);
|
|
1079
|
+
ASSERT_EQ(st, LEPTRIS_OK);
|
|
1080
|
+
ASSERT_NE(doc, nullptr);
|
|
1081
|
+
LeptrisElement root = leptris_document_root(doc);
|
|
1082
|
+
ASSERT_NE(root, nullptr);
|
|
1083
|
+
LeptrisNodeRef text =
|
|
1084
|
+
leptris_node_first_child(leptris_element_as_node(root));
|
|
1085
|
+
ASSERT_NE(text, nullptr);
|
|
1086
|
+
EXPECT_STREQ(leptris_text_node_get_content(text), "hello world");
|
|
1087
|
+
leptris_document_free(doc);
|
|
1088
|
+
}
|
|
@@ -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.421",
|
|
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",
|