Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Performance Benchmarks

Micro-benchmarks for the DVE template engine, run with deno bench.

Quick Start

From the repo root:

deno task bench

Run a single file:

deno bench benchmark/compile.bench.ts
deno bench benchmark/render.bench.ts
deno bench benchmark/eval.bench.ts

What It Covers

File Measures
compile.bench.ts Compiling and validating templates into reusable ASTs
render.bench.ts End-to-end render across every template feature, plus streaming
eval.bench.ts Expression evaluator and HTML escape paths in isolation

Test Environment

  • Machine: Apple M3 Pro
  • Runtime: Deno 2.9.0 (aarch64-apple-darwin)

Results

Each number is the average of 3 deno task bench runs.

Compile

Benchmark time/iter iter/s
compile simple variable 308.4 ns 3,242,000
compile expression template 2.1 µs 469,900
compile loop template 1.0 µs 992,600
compile layout template 920.4 ns 1,086,000
validate layout template 919.5 ns 1,088,000

Render

Benchmark time/iter iter/s
render simple variable 137.7 ns 7,261,000
render raw output 58.6 ns 17,070,000
render escaped output 412.9 ns 2,422,000
render with comment 152.0 ns 6,579,000
render expression evaluation 407.0 ns 2,457,000
render if else chain 102.0 ns 9,806,000
render whitespace control (50) 4.7 µs 211,600
render each item only (50) 5.6 µs 177,400
render each else empty 59.3 ns 16,880,000
render each meta (50) 19.5 µs 51,390
render each meta (500) 195.0 µs 5,128
render each nested (20x5) 20.3 µs 49,140
render include in loop (50) 23.7 µs 42,160
render layout extend 1.3 µs 795,300
render stream each meta (50) 108.7 µs 9,209

Eval

Benchmark time/iter iter/s
eval plain identifier 50.9 ns 19,650,000
eval meta var @index 49.5 ns 20,180,000
eval meta var @first 49.1 ns 20,370,000
eval dotted path 81.7 ns 12,230,000
eval expression cold parse 520.8 ns 1,920,000
run prepared dotted path 22.0 ns 45,390,000
run prepared deep path 17.4 ns 57,380,000
run prepared expression 37.0 ns 27,080,000
run prepared logical 77.2 ns 12,960,000
run prepared ternary 46.7 ns 21,400,000
run prepared nullish 63.5 ns 15,750,000
escape plain text 40.3 ns 24,780,000
escape rich text 479.4 ns 2,086,000