[HN Gopher] Show HN: Mitata - Benchmarking tooling for JavaScript
       ___________________________________________________________________
        
       Show HN: Mitata - Benchmarking tooling for JavaScript
        
       I always had a sweet tooth for how easy it is to use
       google/benchmark, but when working with js, current libraries
       didn't feel right and some were not even accurate enough, so I
       decided to create my own library to make JavaScript benchmarking
       tooling better.  With more free time, I finally implemented all
       features I wished for in 1.0.0 and made a lightweight C++ single-
       header version for moments when google/benchmark is too much.  Hope
       this library helps you as much as it does me.
        
       Author : evnwashere
       Score  : 54 points
       Date   : 2024-09-28 18:54 UTC (4 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | wonger_ wrote:
       | This is for "headless" JavaScript outside the browser, right?
        
         | evnwashere wrote:
         | It works anywhere where javascript works, so you can easily run
         | it in browser too. Tho idea of making jsbench like website but
         | with mitata accuracy (+ dedicated runners) keeps bugging me.
        
         | tbeseda wrote:
         | Never heard JS called "headless". Not sure I like it.
         | 
         | edit: all JS is "headless". almost all languages are headless.
         | _Software_ can be headless or have a GUI. but languages are
         | naturally headless.
        
           | Waterluvian wrote:
           | Headless browsers. I guess this is a very closely related
           | concept.
        
           | blovescoffee wrote:
           | There's a lot of server side js. Mostly plumbing code but
           | there's certainly "headless" js
        
             | tbeseda wrote:
             | I'm very aware of JS run on servers. And I knew that's what
             | OP meant. I'm saying I'm not sure I like the usage. Maybe
             | it's a generational dev vocabulary thing... I prefer
             | "browser" or "client" JS vs "server" or backend
        
       | moltar wrote:
       | Any plans for web compatible output?
       | 
       | I maintain this repo, and we hand roll the stats page, but if we
       | could get that for free it'd be so great!
       | 
       | https://github.com/moltar/typescript-runtime-type-benchmarks
        
         | evnwashere wrote:
         | I have been thinking of reusing/creating something like
         | https://perf.rust-lang.org/ that lets you pick and compare
         | specific hash/commit with all data from json format
        
       | pavi2410 wrote:
       | wow! what a timing! I started building Speedrun yesterday to
       | accommodate my daily needs
       | 
       | https://toolkit.pavi2410.me/tools/speedrun
       | 
       | https://github.com/pavi2410/toolkit/issues/8
        
         | pavi2410 wrote:
         | do you support running the benchmark in a web worker?
        
           | evnwashere wrote:
           | yes, you can import mitata inside web worker and run it
           | there, if you only need raw results you can even use lower
           | level api https://github.com/evanwashere/mitata?tab=readme-
           | ov-file#giv...
        
       | golergka wrote:
       | Wow, I was just looking how to benchmark a streaming JSON parser
       | that I'm working on! I'm creating it specifically for
       | performance-intensive situations with JSON strings sizes up to
       | gigabytes, and I thought that I had to implement about half of
       | the features you mention there, like parametrisation and
       | automatic GC after every test.
        
         | dumbo-octopus wrote:
         | When you say streaming JSON parser, do you mean that it outputs
         | a live "observable" object as it is steaming, or that it just
         | doesn't keep the entire source data in memory? I've done some
         | work for the former for displaying rich LLM outputs as they are
         | delivered - it's a surprisingly underexplored area from what
         | I've seen.
        
       | kookamamie wrote:
       | Is it by accident that "mitata", the project name, means "to
       | measure" in Finnish?
        
         | evnwashere wrote:
         | it was hand picked for exactly that :)
        
       | cybice wrote:
       | Hi! In your benchmark, do you use a fixed number of iterations to
       | stop the test, or do you apply a statistical criterion, such as
       | the Student's t-test, to determine when to stop?
        
         | evnwashere wrote:
         | i didn't want it to be complex so it uses simple time budget +
         | at least x amount of samples, both and more can be configured
         | with lower level api.
         | 
         | in practice i haven't found any js function that gets faster
         | after mitata's time budget (excluding cpu clock speed
         | increasing because of continuous workload)
         | 
         | another problem is garbage collection can cause long pauses
         | that cause big jumps for some runs, thus causing loop to
         | continue searching for best result longer than necessary
        
       | izakfr wrote:
       | This is awesome! I've been working on optimizing a javascript
       | library recently and am feeling the pain of performance testing.
       | I'll check this out.
        
       ___________________________________________________________________
       (page generated 2024-09-28 23:00 UTC)