Search Ctrl K
Home / Tools
THE FEUTEX TOOLKIT

Structure Cache Line Padding

Compare compact structures with line-rounded slots for avoiding adjacent sharing.

Developer workspace● Runs in your browser
01 Your input
02 Your result
View or copy raw result data
FormulaPadded slot size = Math.ceil(size/line)*line; Additional allocated memory = n*(Math.ceil(size/line)*line-size)/1048576

Made for real tasks

  • Compare compact structures with line-rounded slots for avoiding adjacent sharing.
Explore step-by-step workflows →

Worked example

Inputs

Unpadded structure size
24 bytes
Cache line size
64 bytes
Structure count
1000000 structures

Expected results

Padded slot size
64 bytes
Additional allocated memory
38.14697266 MiB

Load the example in the workspace to reproduce these results. Display rounding does not change the underlying calculation.

How to use this tool

  1. Enter unpadded structure size, cache line size, structure count in the displayed units.
  2. Calculate the scenario, then compare it with measurements before changing a system.

Try this example

{
  "size": 24,
  "line": 64,
  "n": 1000000
}

Accuracy and scope

Assumes aligned array base; padding may reduce false sharing but does not guarantee better performance.

Is my data uploaded?

This tool runs locally in your browser. Input and output are not sent to a processing server. Copy or download your result before leaving the page.