HomePhabricator

refactor: use fold expressions instead of recursive calls in (Un)SerializeMany()

Description

refactor: use fold expressions instead of recursive calls in (Un)SerializeMany()

Summary:
Instead of recursively calling SerializeMany and peeling off one
argument at a time, use a fold expression. This simplifies the code,
makes it most likely faster because it reduces the number of function
calls, and compiles faster because there are fewer template
instantiations.

This is a partial backport of core#28203
https://github.com/bitcoin/bitcoin/pull/28203/commits/bd08a008b42dac921bd9c031637e378899c1cd1d
https://github.com/bitcoin/bitcoin/pull/28203/commits/1403d181c106bc271ad2522adebde07c7850069b

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

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

Details

Provenance
Martin Leitner-Ankerl <martin.ankerl@gmail.com>Authored on Aug 2 2023, 18:01
PiRKCommitted on Dec 18 2025, 14:22
PiRKPushed on Dec 18 2025, 14:22
Reviewer
Restricted Project
Differential Revision
D19046: refactor: use fold expressions instead of recursive calls in (Un)SerializeMany()
Parents
rABCa0fcf084c14f: [bitcoinsuite-core] Add script to ASM feature
Branches
Unknown
Tags
Unknown