Page MenuHomePhabricator

Merge #8330: Structure Packing Optimizations in C{,Mutable}Transaction
ClosedPublic

Authored by jasonbcox on Jul 19 2019, 23:34.

Details

Summary

37495e0d8 Reorder C{,Mutable}Transaction for better packing (Jeremy Rubin)

Pull request description:

These commits revise the layout of a few key classes to eliminate padding, eliminating useless memory overhead.

-This reduces CTransaction from 96 bytes to 88 bytes

Tree-SHA512: 91d1fec363edebbb1f1a5b98142c767511e99d3be857148a76e31cc512c9ab3d153083fa6b46b6407974d3b88de984b436c33e8606fbb2b273d74c825195aa17

Backport of Core PR8330
https://github.com/bitcoin/bitcoin/pull/8330/files

Test Plan
make check
gdb bitcoind
gdb> print sizeof(CTransaction)
  # Before patch: 96
  # After patch: 88
gdb> print sizeof(CMutableTransaction)
  # Before patch: 64
  # After patch: 56

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

deadalnix requested changes to this revision.Jul 20 2019, 00:01

The test plan can be automated at compile time.

This revision now requires changes to proceed.Jul 20 2019, 00:01

Added static assertions to check sizes at compile time

deadalnix requested changes to this revision.Jul 24 2019, 13:17
deadalnix added inline comments.
src/primitives/transaction.h
295 ↗(On Diff #10409)

Don't use yoda style.

336 ↗(On Diff #10409)

dito

This revision now requires changes to proceed.Jul 24 2019, 13:17
This revision is now accepted and ready to land.Jul 24 2019, 17:18