moltar / typescript-runtime-type-benchmarks

📊 Benchmark Comparison of Packages with Runtime Validation and TypeScript Support
https://moltar.github.io/typescript-runtime-type-benchmarks/
594 stars 59 forks source link

Categories for AOT, JIT and Dynamic Validation #1126

Open sinclairzx81 opened 11 months ago

sinclairzx81 commented 11 months ago

Hi @moltar!

Hey, was wondering if it might be possible to perhaps group the current validators into categories in accordance with how each validator works (this to provide a bit of insight into some of the performance characteristics of each category).

Currently there is quite the divide between fast and slow and not much indication given as to what makes the faster validators fast (or what trade offs are necessary to attain that performance). Also, having a bit of extra info might bring a few insights to developers wanting to have a go at building out a few more high performance options (we could use a few more) :D

All validators generally fall into one of the following 3 categories:

I was thinking perhaps the easiest way to achieve this (from a visual standpoint) might be to add some iconography next to each validator + a legend somewhere giving info as to what each icon means (possibly including the descriptions listed above). Color coded icons might be a good visual indicator too (a contrasting red, green and blue might work quite well)

Just putting the idea out there :) All the best! S

jakebailey commented 11 months ago

I was no joke just about to file an issue like this!

I come back to these benchmarks semi-regularly to explore the state of things (e.g. to pick a lib again, recheck the usability of libs, the works), but I never want a library which requires me to do codegen or build system modification. I'd personally appreciate some sort of labeling or something which at least lets me know which of the validators are using codegen (so, that first category, AOT) so I know what I'm getting into; I honestly forget what each of the different libs do every time I return to these stats 😅.

Splitting the "non-codegen" into eval and non-eval would also probably be helpful for those who can't use eval for various reasons.

hoeck commented 11 months ago
  • AOT - Uses compiler codegen to produce static validation code
  • JIT - Uses runtime codegen to produce code and executes via eval()
  • Dynamic - Uses dynamic property checking

I like this classification a lot.

How should we present the results? Is a simple, additional filter checkbox enough? Or some group-by? What about a 3-state filter switch: hidden - included - highlighted?

Any ideas / requests?

moltar commented 10 months ago

@sinclairzx81 Love your categorization idea! Really clear thinking there. I wanted to do something like that, but couldn't come up with such a clear and concise description as you did.

How about instead of categories, we use a concept of tags. That way anyone can select any arbitrary assortment of tags to compare. And Deepkit can have both tags?

sinclairzx81 commented 10 months ago

@moltar Hi!

How about instead of categories, we use a concept of tags. That way anyone can select any arbitrary assortment of tags to compare. And Deepkit can have both tags?

This would be perfect! :)

Lyumih commented 10 months ago

Great idea! I want to suggest the following. Make icons AOT, JIT, Dynamic links. Clicking on the icon will open a link with a description of what AOT, JIT, Dynamic is. Unfortunately, I do not know how they differ. But the speed varies at times. And yup, which we have been working on for many years, is almost in last place