HomePhabricator

[Chronik] Use Rust `compress_script_variant` to speed up indexing

Description

[Chronik] Use Rust compress_script_variant to speed up indexing

Summary:
This seems like it shouldn't have a big impact, but bridging to and from C++ has a measurable impact. Most of the compression time is spent in ToRustVec (44ms) and FromRustSlice (19ms), and just 45ms in ScriptCompression.

While chronikreindexing blocks 22000 to 221000, the compression cost went from 162ms to 41ms (which is even below C++'s impl). Without this change, compression cost of chronikreindexing all blocks up to 300000 is 80 seconds, so after this change, this could be just 20s. For a reindex up to block 800000, this could shave away 10 minutes of indexing time.

As a nice side benefit, this removes having to thread fn_compress_script through the code, which makes the code more readable and maintainable.

Test Plan: ninja check-functional

Reviewers: Fabien, #bitcoin_abc

Reviewed By: Fabien, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D14427

Details

Provenance
tobias_ruckAuthored on Aug 29 2023, 14:23
tobias_ruckPushed on Aug 29 2023, 22:04
Reviewer
Restricted Project
Differential Revision
D14427: [Chronik] Use Rust `compress_script_variant` to speed up indexing
Parents
rABCaf6089b30a23: [Chronik] Add `compress_script_variant` to compress script variants
Branches
Unknown
Tags
Unknown