shnewto / bnf

Parse BNF grammar definitions
MIT License
256 stars 22 forks source link

Profile allocations in Divan benchmarks #142

Closed nvzqz closed 8 months ago

nvzqz commented 8 months ago

Divan 0.1.6 introduced AllocProfiler and recently 0.1.8 optimized it to have a minimal footprint.

Example output:

divan                                  fastest       │ slowest       │ median        │ mean          │ samples │ iters
╰─ examples                                          │               │               │               │         │
   ├─ generate_dna                     540.6 ns      │ 18.12 µs      │ 874.6 ns      │ 946.2 ns      │ 432421  │ 432421
   │                                   alloc:        │               │               │               │         │
   │                                     9           │ 16            │ 16            │ 16            │         │
   │                                     123 B       │ 211 B         │ 211 B         │ 211.1 B       │         │
   │                                   dealloc:      │               │               │               │         │
   │                                     9           │ 16            │ 16            │ 16            │         │
   │                                     123 B       │ 211 B         │ 211 B         │ 211.1 B       │         │
   │                                   grow:         │               │               │               │         │
   │                                     0           │ 0             │ 0             │ 0.007         │         │
   │                                     0 B         │ 0 B           │ 0 B           │ 0.063 B       │         │
   ├─ parse_infinite_nullable_grammar  1.166 µs      │ 1.983 ms      │ 137.7 µs      │ 186.4 µs      │ 26771   │ 26771
   │                                   857.1 Kitem/s │ 33.28 Kitem/s │ 348.5 Kitem/s │ 262.8 Kitem/s │         │
   │                                   alloc:        │               │               │               │         │
   │                                     19          │ 4405          │ 2347          │ 3338          │         │
   │                                     2.036 KB    │ 582.9 KB      │ 309 KB        │ 438.7 KB      │         │
   │                                   dealloc:      │               │               │               │         │
   │                                     19          │ 4405          │ 2347          │ 3338          │         │
   │                                     2.036 KB    │ 609.1 KB      │ 321.9 KB      │ 453.9 KB      │         │
   │                                   grow:         │               │               │               │         │
   │                                     0           │ 6             │ 5             │ 4.832         │         │
   │                                     0 B         │ 26.2 KB       │ 12.89 KB      │ 15.19 KB      │         │
   ├─ parse_polish_calculator          5.165 µs      │ 53.6 ms       │ 11.83 µs      │ 754.3 µs      │ 6632    │ 6632
   │                                   alloc:        │               │               │               │         │
   │                                     45          │ 77336         │ 66            │ 1392          │         │
   │                                     6.596 KB    │ 38.77 MB      │ 12.48 KB      │ 690.5 KB      │         │
   │                                   dealloc:      │               │               │               │         │
   │                                     45          │ 77336         │ 66            │ 1392          │         │
   │                                     9.988 KB    │ 66.04 MB      │ 19.2 KB       │ 1.18 MB       │         │
   │                                   grow:         │               │               │               │         │
   │                                     9           │ 22            │ 10            │ 11.31         │         │
   │                                     3.392 KB    │ 27.26 MB      │ 6.72 KB       │ 490.1 KB      │         │
   ╰─ parse_postal                     17.08 µs      │ 186 µs        │ 17.49 µs      │ 17.59 µs      │ 278198  │ 278198
                                       alloc:        │               │               │               │         │
                                         354         │ 354           │ 354           │ 354           │         │
                                         15 KB       │ 15 KB         │ 15 KB         │ 15 KB         │         │
                                       dealloc:      │               │               │               │         │
                                         354         │ 354           │ 354           │ 354           │         │
                                         27.95 KB    │ 27.95 KB      │ 27.95 KB      │ 27.95 KB      │         │
                                       grow:         │               │               │               │         │
                                         107         │ 107           │ 107           │ 107           │         │
                                         12.95 KB    │ 12.95 KB      │ 12.95 KB      │ 12.95 KB      │         │
coveralls commented 8 months ago

Coverage Status

coverage: 97.956%. remained the same when pulling f09bc34af61d59c015a1fa3db7a3b2a0ac7a3f6d on nvzqz:divan-alloc-profiler into c5e3a5b6b1370e6d98e9129028c5a5ce4d745706 on shnewto:main.