|
1 | 1 | import { cn } from "fumadocs-ui/components/api" |
| 2 | +import React from "react" |
2 | 3 |
|
3 | 4 | const barStyles: React.CSSProperties = { |
4 | 5 | height: "30px", |
5 | | - borderRadius: "5px", |
| 6 | + borderRadius: "8px", |
6 | 7 | display: "flex", |
7 | 8 | alignItems: "baseline", |
8 | | - marginRight: "1rem", |
| 9 | + marginRight: "0.5rem", |
| 10 | + marginBottom: "0.5rem", |
9 | 11 | color: "black" |
10 | 12 | } |
11 | 13 |
|
12 | 14 | const arkBarStyles = { |
13 | 15 | ...barStyles, |
14 | 16 | background: |
15 | | - "repeating-linear-gradient(135deg, #40decc, #40decc 10px, #34c8b9 10px, #34c8b9 20px)" |
| 17 | + "repeating-linear-gradient(135deg, #00ffd5, #00ffd5 12px, #00e6bf 12px, #00e6bf 24px)" |
16 | 18 | } |
17 | | - |
18 | 19 | const zodBarStyles = { |
19 | 20 | ...barStyles, |
20 | 21 | background: |
21 | | - "repeating-linear-gradient(135deg, #b084f6, #b084f6 10px, #9a6fe3 10px, #9a6fe3 20px)" |
| 22 | + "repeating-linear-gradient(135deg, rgba(140, 205, 255, 0.6), rgba(140, 205, 255, 0.6) 12px, rgba(124, 189, 237, 0.6) 12px, rgba(124, 189, 237, 0.6) 24px)" |
| 23 | +} |
| 24 | + |
| 25 | +const yupBarStyles = { |
| 26 | + ...barStyles, |
| 27 | + background: |
| 28 | + "repeating-linear-gradient(135deg, rgba(144, 175, 224, 0.7), rgba(144, 175, 224, 0.7) 12px, rgba(133, 157, 199, 0.7) 12px, rgba(133, 157, 199, 0.7) 24px)" |
22 | 29 | } |
23 | 30 |
|
24 | 31 | export const RuntimeBenchmarksGraph: React.FC<{ className?: string }> = ({ |
25 | 32 | className |
26 | 33 | }) => ( |
27 | 34 | <div |
28 | | - style={{ fontSize: 14, fontWeight: 500 }} |
| 35 | + style={{ |
| 36 | + fontSize: 16.8, |
| 37 | + fontWeight: 500, |
| 38 | + display: "flex", |
| 39 | + flexDirection: "column", |
| 40 | + flexGrow: 1 |
| 41 | + }} |
29 | 42 | className={cn("font-semibold text-white", className)} |
30 | 43 | > |
31 | | - <div |
32 | | - style={{ |
33 | | - display: "flex", |
34 | | - flexDirection: "row" |
35 | | - }} |
36 | | - > |
37 | | - <h6 className="text-lg mb-2"> |
38 | | - Object Validation, Node v22.2.0 ( |
39 | | - <a |
40 | | - target="_blank" |
41 | | - href="https://moltar.github.io/typescript-runtime-type-benchmarks/" |
42 | | - > |
43 | | - source |
44 | | - </a> |
45 | | - ) |
46 | | - </h6> |
47 | | - </div> |
48 | | - <div |
49 | | - style={{ |
50 | | - display: "flex", |
51 | | - alignItems: "center" |
52 | | - }} |
53 | | - > |
54 | | - <div style={{ ...arkBarStyles, width: "1.06%" }}></div> |
55 | | - ArkType (15 nanoseconds) |
56 | | - </div> |
57 | | - <div style={{ ...zodBarStyles, width: "100%" }}> |
58 | | - Zod (1374 nanoseconds) |
59 | | - </div> |
60 | | - </div> |
61 | | -) |
62 | | - |
63 | | -export const TypeBenchmarksGraph = () => ( |
64 | | - <div style={{ fontSize: 14, fontWeight: 500 }}> |
65 | | - <div |
66 | | - style={{ |
67 | | - display: "flex", |
68 | | - flexDirection: "row" |
69 | | - }} |
70 | | - > |
71 | | - <h6 style={{ fontSize: 15 }}> |
72 | | - Union Type Instantiations, TypeScript 5.5.3 ( |
73 | | - <a |
74 | | - target="_blank" |
75 | | - href="https://github.com/arktypeio/arktype/blob/468da965d9a2bbb16fe38d37e82c3b35e5158334/ark/repo/scratch/discriminatedComparison.ts" |
76 | | - > |
77 | | - source |
78 | | - </a> |
79 | | - ) |
80 | | - </h6> |
81 | | - </div> |
82 | | - <div |
83 | | - style={{ |
84 | | - display: "flex", |
85 | | - alignItems: "center" |
86 | | - }} |
87 | | - > |
88 | | - <div style={{ ...arkBarStyles, width: "10.94%" }}></div> |
89 | | - ArkType Auto-Discriminated (7,801) |
90 | | - </div> |
91 | | - <div |
92 | | - style={{ |
93 | | - display: "flex", |
94 | | - alignItems: "center" |
95 | | - }} |
96 | | - > |
97 | | - <div style={{ ...zodBarStyles, width: "34.98%" }}></div> |
98 | | - Zod Raw (24,944) |
| 44 | + <div style={{ display: "flex", flexDirection: "row" }}> |
| 45 | + <h6 className="text-xl mb-2">Object Validation, Node v23.6.1</h6>{" "} |
| 46 | + <a |
| 47 | + className="underline ml-2" |
| 48 | + target="_blank" |
| 49 | + href="https://moltar.github.io/typescript-runtime-type-benchmarks/" |
| 50 | + style={{ textDecoration: "underline", color: "#1e90ff" }} |
| 51 | + > |
| 52 | + (source) |
| 53 | + </a> |
99 | 54 | </div> |
100 | | - <div style={{ ...zodBarStyles, width: "100%", justifyContent: "end" }}> |
101 | | - Zod Discriminated (71,312) |
| 55 | + <div style={{ display: "flex", flexDirection: "column", flexGrow: 1 }}> |
| 56 | + <div style={{ display: "flex", alignItems: "center" }}> |
| 57 | + <div style={{ ...arkBarStyles, width: "0.5%" }}></div> |
| 58 | + ArkType ⚡ 14 nanoseconds |
| 59 | + </div> |
| 60 | + <div style={{ ...zodBarStyles, width: "50%" }}> |
| 61 | + Zod 👍 1397 nanoseconds |
| 62 | + </div> |
| 63 | + <div style={{ ...yupBarStyles, width: "100%" }}> |
| 64 | + Yup 🐌 40755 nanoseconds* |
| 65 | + </div> |
| 66 | + <div className="text-xs mt-auto self-end"> |
| 67 | + *scaling generously logarithmized |
| 68 | + </div> |
102 | 69 | </div> |
103 | 70 | </div> |
104 | 71 | ) |
0 commit comments