Skip to content

Shrink struct RExC_state_t #23441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 16, 2025
Merged

Shrink struct RExC_state_t #23441

merged 8 commits into from
Jul 16, 2025

Conversation

ilmari
Copy link
Member

@ilmari ilmari commented Jul 15, 2025

There are lots of I32 fields in the RExC_state_t struct that are only ever
used as booleans. This series of commits converts them to actual booleans,
and then reorders the fields in the struct to elminate alignment holes.

This PR shrinks the size of the struct on a 64-bit Linux non-debugging build
from:

/* size: 368, cachelines: 6, members: 63 */
/* sum members: 363, holes: 1, sum holes: 4 */
/* padding: 1 */
/* last cacheline: 48 bytes */

to:

/* size: 344, cachelines: 6, members: 63 */
/* padding: 5 */
/* last cacheline: 24 bytes */

And on a debugging build from:

/* size: 408, cachelines: 7, members: 69 */
/* sum members: 403, holes: 2, sum holes: 5 */
/* last cacheline: 24 bytes */

to:

/* size: 384, cachelines: 6, members: 69 */
/* sum members: 379, holes: 1, sum holes: 1 */
/* padding: 4 */

  • This set of changes does not require a perldelta entry.

@ilmari ilmari requested a review from demerphq July 15, 2025 16:52
@ilmari ilmari changed the title Shring struct RExC_sate_t Shrink struct RExC_sate_t Jul 15, 2025
@richardleach richardleach changed the title Shrink struct RExC_sate_t Shrink struct RExC_state_t Jul 15, 2025
@ilmari ilmari force-pushed the rexc-state-compact branch from 2e24382 to 1a5ca57 Compare July 16, 2025 11:35
ilmari added 8 commits July 16, 2025 19:28
Combined with the previous previous commits on this branch this
shrinks the size of the struct on a 64-bit Linux non-debugging build
from:

	/* size: 368, cachelines: 6, members: 63 */
	/* sum members: 363, holes: 1, sum holes: 4 */
	/* padding: 1 */
	/* last cacheline: 48 bytes */

to:

	/* size: 344, cachelines: 6, members: 63 */
	/* padding: 5 */
	/* last cacheline: 24 bytes */

And on a debugging build from:

	/* size: 408, cachelines: 7, members: 69 */
	/* sum members: 403, holes: 2, sum holes: 5 */
	/* last cacheline: 24 bytes */

to:

	/* size: 384, cachelines: 6, members: 69 */
	/* sum members: 379, holes: 1, sum holes: 1 */
	/* padding: 4 */
@ilmari ilmari force-pushed the rexc-state-compact branch from 1a5ca57 to 1a0ea8b Compare July 16, 2025 18:31
@ilmari ilmari merged commit 5d3d5d7 into blead Jul 16, 2025
5 checks passed
@ilmari ilmari deleted the rexc-state-compact branch July 16, 2025 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants