ClickHouse / clickhouse-js

Official JS client for ClickHouse DB
https://clickhouse.com
Apache License 2.0
213 stars 26 forks source link

Improved performance when decoding the entire set of rows with streamable JSON formats #253

Closed slvrtrn closed 6 months ago

slvrtrn commented 6 months ago

Summary

slvrtrn commented 6 months ago

@mshustov

What change gave the performance boost?

The decode function did a few unneeded passes on a huge string. It is way less efficient than the stream transformer we already had in the ResultSet.

slvrtrn commented 6 months ago

This: https://github.com/ClickHouse/clickhouse-js/pull/253/files#diff-46e9eda9880b41c04095d911536817d628992924b2bdd3a96f66529dd3628a5bL101-L104

Unless JIT optimizes it out (it does not), it's at least one extra full pass, worst case two.