* docs: fix grammar mistakes in markdown files Correct `its`/`it's`, verb-noun agreement, article and number agreement errors in V-owned documentation. vlib/x/encoding/asn1/DOCS.md: fix the bulk of the issues, including `Its` -> `It`/`It is`/`This is`, `two form` -> `two forms`, `four class` -> `four classes`, `a extra` -> `extra`, and `you hope an universal type` -> `you need a universal type`. Other files: single-grammar fixes in chacha20poly1305, ttf, net/jsonrpc, vpbgen, bench/vectors and examples/templates READMEs. Vendored thirdparty/ files and historical changelog entries are left untouched, since the former are external code and the latter are verbatim commit records. No behavior change. `./v check-md` passes on all changed files. * fix review feedback --------- Co-authored-by: qp <168933756+gabytz777@users.noreply.github.com>
V Benchmarks
All benchmarks compiled with v -prod on Apple M5, 16 GB RAM, macOS (arm64).
V version: 0.5.1.
GC: Boehm vs VGC
Compares Boehm GC (-gc boehm) against V's built-in concurrent tri-color
mark-and-sweep (-gc vgc).
5 iterations per test, median reported.
v run bench/bench_gc.v
test boehm vgc ratio
———————————————————————————————————————————— ————————— ————————— —————————
small allocs (1000000x string) 39 ms 48 ms 1.23x
tree build+walk (depth=18, 10x) 48 ms 118 ms 2.46x
array grow (100x 100000 pushes) 9 ms 26 ms 2.89x
map insert (20x 10k entries) 20 ms 27 ms 1.35x
mixed workload (50 rounds) 10 ms 16 ms 1.60x
heap usage:
boehm: 29856 KB allocated, 29296 KB free
vgc: 131072 KB allocated, 0 KB free
Boehm is still 1.2x-2.9x faster across these workloads and uses ~4x less heap.
Closures
Measures closure creation, invocation, multi-threaded creation, and memory overhead.
v -prod -o /tmp/bench_closure bench/bench_closure.v && /tmp/bench_closure
| Test Name | Iterations | Time(ms) | Ops/sec |
|---------------------------|------------|----------|--------------|
| Normal Function Call | 100000000 | 0 | +inf Mop/s |
| Small Closure Creation | 10000000 | 188 | 53.19 Mop/s |
| Medium Closure Creation | 10000000 | 376 | 26.60 Mop/s |
| Large Closure Creation | 1000000 | 121 | 8.26 Mop/s |
| Small Closure Call | 100000000 | 136 | 735.29 Mop/s |
| Medium Closure Call | 100000000 | 133 | 751.88 Mop/s |
| Large Closure Call | 10000000 | 16 | 625.00 Mop/s |
| Multi-threaded Creation | 1000000 | 95 | 10.53 Mop/s |
Memory: ~69 bytes per closure (medium, 4 captured vars). Closure calls are ~625-750 Mop/s.
String Deduplication
Compares four deduplication strategies on 10,000 strings with ~30% duplicates.
v -prod -o /tmp/bench_string_dedup bench/bench_string_dedup.v && /tmp/bench_string_dedup
Method 1 (basic array) 33 ms 7000 unique
Method 2 (pre-allocated array) 27 ms 7000 unique
Method 3 (map) 0 ms 7000 unique
Method 4 (set) 0 ms 7000 unique
Maps and sets are orders of magnitude faster than linear array search for deduplication.
Vectors (Boids Simulation)
N-body boids simulation with 10,000 entities: cohesion, separation, and alignment.
v -prod -o /tmp/bench_vectors bench/vectors/vectors.v && /tmp/bench_vectors
~50 ms per run (after warmup)
Crypto: ECDSA
Key generation, signing, and verification (1,000 iterations each).
v -prod -o /tmp/bench_ecdsa bench/crypto/ecdsa/ecdsa.v && /tmp/bench_ecdsa
Average key generation time: 9 µs
Average sign time: 11 µs
Average verify time: 30 µs