diff options
| author | eunhhu <[email protected]> | 2026-10-19 05:16:07 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-10-19 05:16:07 +0100 |
| commit | bcf9a88ee0ac71168ef2372b360cf063fa3a82b9 (patch) | |
| tree | c8b7d9321e7db185fa6426762ee765d441ce399a /research/experiments | |
| parent | 5df2e814937e32a54c77c1ded66b5124e6017cfc (diff) | |
| download | pure-bcf9a88ee0ac71168ef2372b360cf063fa3a82b9.tar.gz pure-bcf9a88ee0ac71168ef2372b360cf063fa3a82b9.zip | |
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
Diffstat (limited to 'research/experiments')
7 files changed, 30 insertions, 7 deletions
diff --git a/research/experiments/044-specs/2026-10-19-dns-after.jsonl b/research/experiments/044-specs/2026-10-19-dns-after.jsonl new file mode 100644 index 0000000..529ebbc --- /dev/null +++ b/research/experiments/044-specs/2026-10-19-dns-after.jsonl @@ -0,0 +1,4 @@ +{"messages": 400, "bytes": 148582, "records": 3466, "right": {"batches": 400, "rounds": 400, "all": 400}, "paths_same": true, "damaged": 300, "damaged_refused": 185, "damaged_agreed": 300, "aup_lines": 106, "aup_brace_lines": 18, "python_lines": 72} +{"messages":400,"bytes":148582,"jit":"0","batch":"","c_ns_per_byte":3.657,"resolver_read_ns_per_byte":4.406,"pure_ns_per_byte":221.336,"to_c":60.5,"to_resolver_read":50.2,"instructions":7409761,"instructions_per_byte":49.9} +{"messages":400,"bytes":148582,"jit":"0","batch":"0","c_ns_per_byte":3.656,"resolver_read_ns_per_byte":4.402,"pure_ns_per_byte":221.159,"to_c":60.5,"to_resolver_read":50.2,"instructions":7409761,"instructions_per_byte":49.9} +{"messages":400,"bytes":148582,"jit":"all","batch":"","c_ns_per_byte":3.658,"resolver_read_ns_per_byte":4.401,"pure_ns_per_byte":203.141,"to_c":55.5,"to_resolver_read":46.2,"instructions":7409761,"instructions_per_byte":49.9} diff --git a/research/experiments/044-specs/2026-10-19-http-after.jsonl b/research/experiments/044-specs/2026-10-19-http-after.jsonl new file mode 100644 index 0000000..d3c57ef --- /dev/null +++ b/research/experiments/044-specs/2026-10-19-http-after.jsonl @@ -0,0 +1,4 @@ +{"streams": 200, "bytes": 132623, "requests": 578, "right": {"whole": 200, "random": 200, "bytes": 50}, "paths": {"batches": 200, "rounds": 200, "all": 200}, "paths_same": true, "damaged": 200, "damaged_refused": 35, "damaged_agreed": 200, "aup_lines": 148, "aup_brace_lines": 21, "python_lines": 79} +{"streams":151,"bytes":98838,"requests":444,"jit":"0","batch":"","c_ns_per_byte":3.249,"pure_ns_per_byte":270.433,"to_c":83.2,"instructions":6074414,"instructions_per_byte":61.5} +{"streams":151,"bytes":98838,"requests":444,"jit":"0","batch":"0","c_ns_per_byte":3.250,"pure_ns_per_byte":270.680,"to_c":83.3,"instructions":6074414,"instructions_per_byte":61.5} +{"streams":151,"bytes":98838,"requests":444,"jit":"all","batch":"","c_ns_per_byte":3.245,"pure_ns_per_byte":270.454,"to_c":83.3,"instructions":6074414,"instructions_per_byte":61.5} diff --git a/research/experiments/044-specs/2026-10-19-inflate-after.jsonl b/research/experiments/044-specs/2026-10-19-inflate-after.jsonl new file mode 100644 index 0000000..179d2de --- /dev/null +++ b/research/experiments/044-specs/2026-10-19-inflate-after.jsonl @@ -0,0 +1,4 @@ +{"streams": 640, "bytes": 6488480, "right": {"batches": 640, "rounds": 640, "all": 640}, "paths_same": true, "damaged": 240, "damaged_refused": 165, "damaged_agreed": 240, "aup_lines": 121, "aup_brace_lines": 15, "python_lines": 81} +{"size":65536,"stream":22991,"jit":"0","batch":"","c_ns_per_byte":11.140,"zlib_ns_per_byte":3.499,"pure_ns_per_byte":1138.637,"to_c":102.2,"to_zlib":325.4,"instructions":12528479,"instructions_per_byte":191.2} +{"size":65536,"stream":22991,"jit":"0","batch":"0","c_ns_per_byte":11.121,"zlib_ns_per_byte":3.505,"pure_ns_per_byte":1139.351,"to_c":102.5,"to_zlib":325.1,"instructions":12528479,"instructions_per_byte":191.2} +{"size":65536,"stream":22991,"jit":"all","batch":"","c_ns_per_byte":10.649,"zlib_ns_per_byte":3.499,"pure_ns_per_byte":1136.972,"to_c":106.8,"to_zlib":324.9,"instructions":12528479,"instructions_per_byte":191.2} diff --git a/research/experiments/044-specs/http_check.py b/research/experiments/044-specs/http_check.py index e3982c3..305f783 100644 --- a/research/experiments/044-specs/http_check.py +++ b/research/experiments/044-specs/http_check.py @@ -137,7 +137,7 @@ def run(module, packets, env, work): pairs = lambda fs: [(bytes.fromhex(f['name']), bytes.fromhex(f['value'])) for f in fs] requests = [(bytes.fromhex(r['method']), bytes.fromhex(r['target']), r['minor'], pairs(r['fields']), bytes.fromhex(r['body']), pairs(r['trailers'])) for r in s['requests']] - left = bytes.fromhex(s['pending'][0]['data']) if s['pending'] else b'' + left = bytes.fromhex(s['pending']) # a bytes state (028) return out, (requests, left), any(json.loads(line)['fault'] != 'none' for line in out) diff --git a/research/experiments/044-specs/http_time.c b/research/experiments/044-specs/http_time.c index 51bd595..dc85fc1 100644 --- a/research/experiments/044-specs/http_time.c +++ b/research/experiments/044-specs/http_time.c @@ -217,7 +217,7 @@ int main(int argc, char **argv) { } work += app.work; } - if ((long)pure_list_count(app.lists[requests]) != c_requests || pure_list_count(app.lists[left])) { + if ((long)pure_list_count(app.lists[requests]) != c_requests || pure_draft_size(app.texts[left])) { fprintf(stderr, "Pure read %zu requests, C %ld\n", pure_list_count(app.lists[requests]), c_requests); return 1; } diff --git a/research/experiments/044-specs/inflate_check.py b/research/experiments/044-specs/inflate_check.py index c3f37b4..d71e59e 100644 --- a/research/experiments/044-specs/inflate_check.py +++ b/research/experiments/044-specs/inflate_check.py @@ -72,8 +72,7 @@ def run(module, packed_streams, env, work): got = [] for line in out: state = json.loads(line) - items = state['states']['inflated'] - got.append(bytes.fromhex(items[-1]['data']) if state['fault'] == 'none' and items else None) + got.append(bytes.fromhex(state['states']['inflated']) if state['fault'] == 'none' else None) # a bytes state (028) return out, got 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; |
