enhance-dev / enhance-ssr

Server side render for custom elements.
143 stars 9 forks source link

Experiment: Add benchmarking for common element types #61

Open tbeseda opened 6 months ago

tbeseda commented 6 months ago
cd bench
npm i
node run.mjs

Current results:

┌─────────┬─────────────────────────┬─────────┬─────────┬─────────┬────────────────────┐
│ (index) │ name                    │ ops/sec │ average │ samples │ relative to simple │
├─────────┼─────────────────────────┼─────────┼─────────┼─────────┼────────────────────┤
│ 0       │ 'simple'                │ 248079  │ '0.004' │ 24808   │ ''                 │
│ 1       │ 'slot'                  │ 173084  │ '0.006' │ 17309   │ '1.43 x slower'    │
│ 2       │ 'nested'                │ 168844  │ '0.006' │ 16885   │ '1.47 x slower'    │
│ 3       │ 'scripted'              │ 139532  │ '0.007' │ 13954   │ '1.78 x slower'    │
│ 4       │ 'styled'                │ 108824  │ '0.009' │ 10883   │ '2.28 x slower'    │
│ 5       │ 'scripted import'       │ 101346  │ '0.010' │ 10135   │ '2.45 x slower'    │
│ 6       │ 'styled host'           │ 34218   │ '0.029' │ 3422    │ '7.25 x slower'    │
│ 7       │ 'super'                 │ 31448   │ '0.032' │ 3145    │ '7.89 x slower'    │
│ 8       │ 'super++'               │ 17576   │ '0.057' │ 1758    │ '14.11 x slower'   │
│ 9       │ 'simple [100]'          │ 3428    │ '0.292' │ 343     │ '72.37 x slower'   │
│ 10      │ 'slot [100]'            │ 2095    │ '0.477' │ 210     │ '118.41 x slower'  │
│ 11      │ 'nested [100]'          │ 2076    │ '0.482' │ 208     │ '119.50 x slower'  │
│ 12      │ 'styled [100]'          │ 1834    │ '0.545' │ 184     │ '135.27 x slower'  │
│ 13      │ 'scripted [100]'        │ 1739    │ '0.575' │ 174     │ '142.66 x slower'  │
│ 14      │ 'scripted import [100]' │ 1449    │ '0.690' │ 145     │ '171.21 x slower'  │
│ 15      │ 'styled host [100]'     │ 413     │ '2.420' │ 42      │ '600.68 x slower'  │
│ 16      │ 'super [100]'           │ 385     │ '2.595' │ 39      │ '644.36 x slower'  │
│ 17      │ 'super++ [100]'         │ 193     │ '5.165' │ 20      │ '1285.38 x slower' │
└─────────┴─────────────────────────┴─────────┴─────────┴─────────┴────────────────────┘
kristoferjoseph commented 6 months ago

I am unable to run the bench

How does this work?

tbeseda commented 6 months ago

I am unable to run the bench

How does this work?

Did you run the instructions in the PR comment or? what's the error?

edit: I had an error in my instructions! sorry about that. it's just node run.mjs