From bcf9a88ee0ac71168ef2372b360cf063fa3a82b9 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Mon, 19 Oct 2026 05:16:07 +0100 Subject: 140 measured again without the workarounds: the three specs' checks pass on the three paths as before (zlib's 640 streams and 240 damaged, dnspython's 400 messages and 300 damaged, h11's 200 streams on every cut and 200 damaged); lines inflate 132 to 121, DNS 115 to 106, HTTP 159 to 148 (Python's 1.5-1.9x, was 1.6-2.0x); time inflate 1,152 to 1,139 ns a byte (102x C), DNS 244 to 221 (61x, instructions 63.6 to 49.9 a byte: == in its compression), HTTP 278 to 270 (83x, with the free empty join); left: DNS's view calls no block fn, HTTP's let list takes no list value; module_specs, the checks and the timing tools read the bytes states (inflated, pending); the suite table's rows for 1, 3 and 9 --- research/experiments/044-specs/inflate_time.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'research/experiments/044-specs/inflate_time.c') diff --git a/research/experiments/044-specs/inflate_time.c b/research/experiments/044-specs/inflate_time.c index 34cc2d5..8463a22 100644 --- a/research/experiments/044-specs/inflate_time.c +++ b/research/experiments/044-specs/inflate_time.c @@ -159,6 +159,15 @@ static int by_value(const void *a, const void *b) { return (x > y) - (x < y); } +/* Each span of a draft read in order against the original's bytes from where the last ended. */ +static size_t compared; +static bool compare_original(void *context, PureSpan span) { + const unsigned char *original = context; + if (memcmp(original + compared, span.data, span.size)) return false; + compared += span.size; + return true; +} + static unsigned char *whole(const char *path, size_t *size) { FILE *f = fopen(path, "rb"); if (!f) return NULL; @@ -199,9 +208,12 @@ int main(int argc, char **argv) { return 1; } uint64_t work = app.work - before; - const PureList *list = app.lists[state]; - PureCell cell = pure_list_count(list) == 1 ? pure_list_get(list, 0, 0) : (PureCell){0}; - if (cell.size != original_size || memcmp(cell.text, original, original_size)) { fprintf(stderr, "Pure's bytes differ\n"); return 1; } + /* The bytes state (028): its draft's bytes. */ + if (pure_draft_size(app.texts[state]) != original_size || + pure_draft_read(app.texts[state], 0, original_size, compare_original, original) != PURE_OK) { + fprintf(stderr, "Pure's bytes differ\n"); + return 1; + } double c_runs[7], zlib_runs[7], pure_runs[7]; volatile unsigned char sink = 0; -- cgit v1.2.3