dominikg/svite

benchmark - challenge

dominikg opened this issue · 4 comments

Welcome to the svite benchmark challenge

Lets see who's got the fastest hot module updates in github town in 3 easy steps

1. install

mac/linux/wsl
npx degit dominikg/svite/examples/hmr-benchmark svite-bench && cd svite-bench && npm i 
windows
npx degit dominikg/svite/examples/hmr-benchmark svite-bench ; cd svite-bench ; npm i 

2. inside svite-bench directory execute

node benchmark --headless --gif # --gif only works with ImageMagick 'convert' in path.

3. add comment with output and svite-bench/dist/benchmark.gif below

FAQ
Whats on the line?

Bragging rights.

What does it do?
  • start vite dev-server
  • open chromium with dev page
  • trigger hot module reloads (44)
    • write App.svelte, add 1 visible change (new text character or style color)
    • after each change, wait for the browser console to log the updated message
    • measure the time it took from writing the file to the rendered update
  • close chromium
  • stop dev-server
  • create stats
  • optionally create gif

Go read the code

help
    benchmark supports the following arguments:
      --headless    - render headless
      --gif         - create a gif in ./dist (requires ImageMagick 'convert' in path)
      --resultfile  - write stats to a timestamped file
      --throttle X  - wait X milliseconds between writes to the same file
      --help,-h     - print this message
gif output does not work

Sorry, ImageMagick convert binary has to be available in path

whats that throttle thing about?

The benchmark writes to the same file in very short intervals. sometimes so short, that the update watcher misses a write and then the process gets stuck as benchmark waits for an update to complete before writing the next step. It automatically adds a throttle to prevent this which increases 10ms every time it gets stuck. You can prevent this dance by providing a throttle argument at start

benchmark

{
  system: {
    platform: 'linux',
    cpu: { brand: 'Core™ i7-7500U', cores: 4, physicalCores: 2 },
    mem: { total: 16530305024, available: 11239120896, free: 7456063488 },
    date: 'Thu, 02 Jul 2020 19:09:21 GMT'
  },
  versions: { benchmark: '0.1.1', svite: '0.1.0', vite: '1.0.0-beta.8' },
  stats: {
    boot: { vite: 774, pageLoad: 1289 },
    updates: {
      count: 44,
      sum: 3079,
      avg: 69.98,
      min: 50,
      max: 102,
      durations: '102,79,67,70,83,83,80,71,80,70,99,81,70,79,71,83,63,50,71,83,67,62,50,67,70,79,54,83,67,63,70,62,55,62,71,67,62,54,64,64,71,63,54,63'
    }
  },
  settings: { headless: true, throttle: 0, gif: true }
}
{
  system: {
    platform: 'win32',
    cpu: {
      brand: 'Ryzen 7 1700 Eight-Core Processor',
      cores: 16,
      physicalCores: 8
    },
    mem: { total: 17111248896, available: 4399017984, free: 4399017984 },
    date: 'Thu, 02 Jul 2020 20:25:05 GMT'
  },
  versions: { benchmark: '0.1.1', svite: '0.1.0', vite: '1.0.0-beta.10' },
  stats: {
    boot: { vite: 566, pageLoad: 1325 },
    updates: {
      count: 44,
      sum: 10273,
      avg: 233.48,
      min: 232,
      max: 241,
      durations: '241,234,233,234,232,232,233,235,232,234,233,233,235,232,234,233,234,233,232,235,233,233,233,234,233,232,234,233,235,232,232,235,233,233,234,234,232,236,233,232,232,234,233,234'
    }
  },
  settings: { headless: true, throttle: 0, gif: false }
}

You can still post scores but i'm closing this as it is not really an 'issue'

{
system: {
platform: 'linux',
cpu: { brand: 'Core™ i5-3320M', cores: 4, physicalCores: 2 },
mem: { total: 6104436736, available: 2888302592, free: 541343744 },
date: 'Wed, 19 Aug 2020 15:02:31 GMT'
},
versions: { benchmark: '0.2.0', svite: '0.5.0', vite: '1.0.0-rc.4' },
stats: {
boot: { vite: 1203, pageLoad: 5878 },
updates: {
count: 44,
sum: 3345,
avg: 76.02,
min: 65,
max: 163,
durations: '163,132,67,83,84,67,83,66,85,82,66,68,100,66,67,84,66,67,67,66,66,67,83,83,67,83,66,68,83,66,67,84,66,67,66,66,68,65,83,84,66,67,66,69'
}
},
settings: { headless: true, throttle: 0, gif: true, typescript: false }
}