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
This project contains benchmarks for the [ts-proto](https://www.npmjs.com/package/ts-proto), [google-protobuf](https://www.npmjs.com/package/google-protobuf), and [protobuf-ts](https://www.npmjs.com/package/protobuf-ts) libraries.
3
+
This project benchmarks the performance of the following Protocol Buffers libraries for JavaScript and TypeScript:
Approximately one year ago, we migrated from `google-protobuf` to `ts-proto (V1)` to take advantage of its improved performance and modern TypeScript compatibility. With the recent release of `ts-proto (V2)`, we included it in our benchmarks, expecting further performance enhancements. However, the results reveal a **performance regression** in `ts-proto (V2)` compared to its predecessor.
53
+
54
+
### Key Insights
55
+
56
+
#### Read Inputs
57
+
-**`ts-proto (V1)`** achieves the best performance with **8,078 ops/sec** and the lowest average latency of **131,998.64 ns**.
58
+
-**`ts-proto (V2)`** shows a **13.7% decrease in throughput** compared to V1, achieving only **6,972 ops/sec**, with an average latency of **153,027.88 ns**.
-**`protobuf-ts`** lags behind, delivering **6,746 ops/sec** and the highest latency of **158,944.02 ns**.
61
+
62
+
#### Update Inputs
63
+
-**`ts-proto (V1)`** leads again, achieving **7,090 ops/sec** with an average latency of **148,810.31 ns**.
64
+
-**`ts-proto (V2)`** suffers a significant **26.5% drop in throughput** compared to V1, with only **5,209 ops/sec** and a latency increase to **204,076.29 ns**.
65
+
-**`google-protobuf`** performs better than `ts-proto (V2)` with **6,314 ops/sec**, but trails behind `ts-proto (V1)`.
66
+
-**`protobuf-ts`** ranks the lowest, with **4,919 ops/sec** and the highest average latency of **216,651.99 ns**.
67
+
68
+
### Observations
69
+
- The migration from `google-protobuf` to `ts-proto (V1)` last year proved to be a clear performance improvement.
70
+
- The release of `ts-proto (V2)`, however, introduces regressions:
71
+
-**Read Inputs:** Throughput drops by **13.7%**, and latency increases by **16%** compared to V1.
72
+
-**Update Inputs:** Throughput drops by **26.5%**, and latency increases by **37%** compared to V1.
73
+
- Despite its age, **`google-protobuf`** remains competitive, especially for read operations.
74
+
-**`protobuf-ts`** shows consistently poor performance across both tasks, highlighting room for optimization.
75
+
76
+
## Conclusion
77
+
78
+
While `ts-proto (V2)` was expected to outperform its predecessor, the benchmarks reveal clear regressions in both throughput and latency. Any potential feature improvements in V2 should be carefully weighed against these performance drawbacks.
79
+
80
+
For now, **`ts-proto (V1)`** remains the best choice for performance in our use case.
0 commit comments