You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| 2025-04-13 |2| arktype | 2 | 147 KB |_0_|**1**|**1**|_0_|**1**|875 ms _-1_|709 ms _-1_|_0_|**1**|
40
+
| 2025-04-13 |8| valibot |**0**| 5 KB |**1**|**1**|**1**|**1**|**1**| 72 ms **1**|10 ms **1**|**1**|_0_|
41
+
| 2025-04-13 |4|@zod/mini| 1 |21 KB|**1**|**1**|_0_|**1**|**1**| 218 ms _0_| 131 ms _0_|_0_|_0_|
42
+
| 2025-04-13 |8| zod v3|**0**| 60 KB|_0_|**1**|**1**|**1**|**1**|102 ms **1**| 35 ms **1**|**1**|**1**|
43
+
| 2025-04-13 |5|zod v4 | 1 |49 KB |_0_|**1**|**1**|**1**|**1**|225 ms _0_|144 ms _0_|_0_|**1**|
44
44
45
45
Legend :
46
46
47
47
- Deps : the number of dependencies of the library
48
48
- Size : the minified build size in bytes of the related file in `src`, run `bun run build` to see by yourself
49
49
- Light : 1 point if the build is `<= 20 KB`
50
-
- Input : 1 point if the library can see that `age` is optional in the input but not optional in `type User` the output type
50
+
- Input A : 1 point if the library can see that `age` is `optional, number` in the input but `not optional, number` in `type User` the output type
51
+
- Input B : 1 point if the library can see that `phone` is `optional, string or number` in the input but `not optional, string` in `type User` the output type
51
52
- Throw : 1 point if the library have a parse or throw method, useful when we don't want to handle the error cases
52
53
- Safe : 1 point if the library have a safe parse method that will not throw and usually return a `Result` type
53
54
- Script exec : 1 point if the average time in ms to execute the test file with bun is `<= 100ms`, check the `bun run bench` command output
@@ -69,7 +70,10 @@ Ok the build size is bigger but it does not impact the performance that much.
69
70
70
71
The 35ms vs 11ms seems like a 3x difference but it's the time to run 1000 iterations. So in the end it's not that much of a difference in a real world scenario.
71
72
72
-
For some weird reason zod4 seems to be slower than zod3
73
+
## Remarks
74
+
75
+
1. For some weird reason Zod v4 seems to be slower than Zod v3
76
+
2. Zod mini not handling the `or` operator is a blocker to me, hopefully it will be added in the future
73
77
74
78
## Todo
75
79
@@ -100,7 +104,7 @@ Just open an issue or a PR, I'll be happy to discuss it with you <3
100
104
-[Shields.io](https://shields.io) : for the nice badges on top of this readme
101
105
-[Valibot](https://github.com/fabian-hiller/valibot) : for making this comparison possible
102
106
-[Zod](https://github.com/colinhacks/zod) : for making this comparison possible
103
-
107
+
104
108
## Stargazers over time
105
109
106
110
[](https://starchart.cc/Shuunen/validation-lib-comparison)
0 commit comments