Skip to content

Benchmarking Guide

Krishanth edited this page Oct 15, 2026 · 1 revision

Benchmarking Guide

EveryO — Performance Measurement, Profiling & Reproducible Experiments

Measure Precisely · Compare Fairly · Report Transparently

Framework Benchmarking Python License

A standardized engineering methodology for evaluating the computational performance, numerical behavior, and resource efficiency of EveryO.

Home · Performance Optimization · Testing and Quality Assurance · Best Practices


Repository: github.com/krishanth7/EveryO

Maintainer: @krishanth7

Document Classification: Engineering methodology

Project Status: Experimental / Alpha

Important

Benchmark Integrity

EveryO is designed primarily for education, experimentation, and numerical verification. It is not represented as a production-scale training runtime.

All benchmark results must identify their hardware, software versions, input shapes, numerical precision, measurement methodology, and execution conditions.

The numerical examples in this guide are illustrative calculations, not measured EveryO benchmark results.


Table of Contents

  1. Purpose and Scope
  2. Benchmarking Principles
  3. Benchmark Categories
  4. Benchmark Environment
  5. Reproducibility Requirements
  6. Benchmark Workflow
  7. Timing Methodology
  8. Statistical Analysis
  9. Tensor Operation Benchmarks
  10. Matrix Multiplication Benchmarks
  11. Automatic Differentiation Benchmarks
  12. Neural Network Benchmarks
  13. Training Throughput
  14. Optimizer Benchmarks
  15. Data Pipeline Benchmarks
  16. Memory Profiling
  17. CPU Performance
  18. CUDA Performance
  19. Mixed Precision Benchmarks
  20. Quantization Benchmarks
  21. Distributed Training Benchmarks
  22. ONNX Runtime Benchmarks
  23. Numerical Accuracy
  24. Performance Profiling
  25. Performance Regression Testing
  26. Benchmark Reporting
  27. Common Benchmarking Mistakes
  28. Acceptance Criteria
  29. Benchmark Submission Guidelines
  30. Official Resources

1. Purpose and Scope

Benchmarking provides objective evidence about how software behaves under defined workloads.

For EveryO, benchmarking should answer:

  • How long does an operation take?
  • How does runtime change with tensor size?
  • How much memory does an operation consume?
  • How does backward execution compare with forward execution?
  • How does performance vary across devices?
  • How does numerical precision affect results?
  • Does a code change introduce a performance regression?

1.1 Primary Objectives

EveryO benchmarking should emphasize:

  1. Reproducibility.
  2. Correctness.
  3. Transparency.
  4. Fair comparison.
  5. Resource efficiency.
  6. Regression detection.

1.2 Scope

This guide covers:

  • CPU tensor execution.
  • Automatic differentiation.
  • Neural network layers.
  • Model training.
  • Optional CUDA acceleration.
  • Mixed precision.
  • Quantization.
  • Distributed execution.
  • ONNX interoperability.

2. Benchmarking Principles

2.1 Correctness Before Speed

A faster operation is not an improvement if it produces incorrect results.

2.2 Compare Equivalent Workloads

All implementations must receive equivalent inputs and perform equivalent computations.

2.3 Separate Setup from Execution

Exclude setup overhead from kernel-only benchmarks, but include it when measuring end-to-end latency.

2.4 Report Variability

Do not report a single favorable measurement as representative performance.

2.5 Preserve Reproducibility

Benchmark reports should contain sufficient information for another developer to repeat the experiment.

2.6 Avoid Unsupported Conclusions

A result on one device does not establish universal performance superiority.


3. Benchmark Categories

Category Primary Measurement
Tensor operations Latency
Matrix multiplication Latency and throughput
Automatic differentiation Forward/backward latency
Neural networks Inference latency
Training Samples per second
Optimizers Update latency
Data pipeline Batches per second
Memory Peak allocation
CUDA Kernel and end-to-end latency
Mixed precision Speed, memory, numerical error
Quantization Model size and numerical fidelity
Distributed training Scaling efficiency
ONNX Runtime latency and output agreement

4. Benchmark Environment

Every benchmark should record its environment.

4.1 Required Metadata

benchmark:
  framework: EveryO
  framework_version: "0.2.0"

environment:
  python_version: "record actual version"
  numpy_version: "record actual version"
  operating_system: "record actual OS"

hardware:
  cpu: "record CPU model"
  gpu: "record GPU model or none"
  ram_gb: "record available RAM"

execution:
  device: cpu
  dtype: float32
  warmup_iterations: 10
  measured_iterations: 100

This is a suggested reporting schema, not a required EveryO configuration file.

4.2 Capture Software Versions

python --version

python -m pip show everyo

python -m pip show numpy

4.3 Capture Git Revision

git rev-parse HEAD

4.4 CPU Configuration

Record:

  • CPU model.
  • Core count.
  • Thread configuration.
  • BLAS implementation, when relevant.
  • Power and thermal conditions.

4.5 GPU Configuration

Record:

  • GPU model.
  • CUDA Toolkit version.
  • Driver version.
  • Device memory.
  • Whether measurements include host-device transfers.

5. Reproducibility Requirements

5.1 Use Controlled Inputs

Use consistent shapes, dtypes, and input distributions.

5.2 Record Random Seeds

When random inputs are used, record the seed.

5.3 Control Background Activity

Avoid benchmarking during unrelated CPU- or GPU-intensive workloads.

5.4 Repeat Measurements

Use multiple iterations and, when appropriate, independent benchmark runs.

5.5 Record Dependency Versions

python -m pip freeze > benchmark-requirements.txt

5.6 Preserve Raw Results

Keep individual timing samples where practical, not just the final summary.


6. Benchmark Workflow

           DEFINE WORKLOAD
                 |
                 v
           VERIFY OUTPUT
                 |
                 v
          RECORD ENVIRONMENT
                 |
                 v
             WARM UP
                 |
                 v
         RUN MEASUREMENTS
                 |
                 v
        COLLECT RAW RESULTS
                 |
                 v
       COMPUTE STATISTICS
                 |
                 v
       VALIDATE COMPARISON
                 |
                 v
         PUBLISH REPORT

6.1 Preparation

Define:

  • Operation.
  • Input shape.
  • Dtype.
  • Device.
  • Reference implementation.
  • Correctness tolerance.

6.2 Execution

Run warm-up iterations before collecting timed samples.

6.3 Verification

Check numerical results before reporting performance.

6.4 Reporting

Publish both the measured results and their limitations.


7. Timing Methodology

7.1 Use a Monotonic High-Resolution Timer

Python's time.perf_counter_ns() is appropriate for measuring elapsed wall-clock time.

7.2 Example CPU Timing Helper

import statistics
import time


def benchmark(operation, warmup=10, repeat=100):
    if warmup < 0 or repeat < 1:
        raise ValueError("Invalid benchmark iteration count")

    for _ in range(warmup):
        operation()

    samples_ms = []

    for _ in range(repeat):
        start = time.perf_counter_ns()

        operation()

        end = time.perf_counter_ns()

        samples_ms.append((end - start) / 1_000_000)

    return {
        "median_ms": statistics.median(samples_ms),
        "mean_ms": statistics.mean(samples_ms),
        "min_ms": min(samples_ms),
        "max_ms": max(samples_ms),
        "samples_ms": samples_ms,
    }

7.3 Important Limitation

This helper measures synchronous CPU execution.

For asynchronous GPU operations, synchronization or device-specific timing is required.

Without synchronization, the measured interval may capture only kernel submission overhead.

7.4 Timer Overhead

For very short operations, Python call and timer overhead can materially affect results.

Measure larger batches of repeated operations or use a suitable dedicated microbenchmark framework when necessary.


8. Statistical Analysis

8.1 Arithmetic Mean

[ \bar{x}=\frac{1}{n}\sum_{i=1}^{n}x_i ]

8.2 Median

The median is often useful for latency reporting because it is less sensitive to extreme observations.

8.3 Standard Deviation

[ s=\sqrt{\frac{\sum_{i=1}^{n}(x_i-\bar{x})^2}{n-1}} ]

8.4 Percentiles

Consider reporting:

  • P50.
  • P90.
  • P95.
  • P99.

Percentiles are especially useful when evaluating latency variability.

8.5 Recommended Summary

Metric Meaning
Mean Average latency
Median Typical latency
P95 Tail latency
Standard deviation Variability
Minimum Fastest observation
Maximum Slowest observation

9. Tensor Operation Benchmarks

9.1 Recommended Operations

  • Addition.
  • Multiplication.
  • Reduction.
  • Reshape.
  • Broadcasting.
  • Matrix multiplication.

9.2 Suggested Shapes

Workload Shape
Small vector (128,)
Medium vector (4096,)
Large vector (1048576,)
Small matrix (128, 128)
Medium matrix (512, 512)
Large matrix (2048, 2048)

These are suggested workloads, not official performance thresholds.

9.3 Example

import everyo as eo

a = eo.tensor([1.0, 2.0, 3.0])
b = eo.tensor([4.0, 5.0, 6.0])

result = a + b

print(result)

For serious timing measurements, use appropriately sized inputs and exclude tensor construction when measuring only the addition operation.


10. Matrix Multiplication Benchmarks

Matrix multiplication is an important computational workload.

10.1 Operation

[ C=AB ]

For:

[ A\in\mathbb{R}^{M\times K} ]

and:

[ B\in\mathbb{R}^{K\times N} ]

the result is:

[ C\in\mathbb{R}^{M\times N} ]

10.2 Approximate FLOP Count

[ FLOPs\approx2MKN ]

This counts approximately one multiplication and one addition per inner-product term.

10.3 Throughput

[ GFLOPS= \frac{2MKN}{t\times10^9} ]

where (t) is elapsed time in seconds.

10.4 Example Calculation

For a 1024 × 1024 matrix multiplication:

[ FLOPs\approx2(1024)^3 ]

[ FLOPs\approx2.147\times10^9 ]

If an implementation hypothetically takes 0.05 seconds:

[ GFLOPS\approx42.95 ]

This is a mathematical illustration, not an EveryO measurement.

10.5 Repository Benchmark

The repository documents:

python benchmarks/benchmark_matmul.py --sizes 128 512 1024 2048

Check the script's current command-line options before modifying the invocation.


11. Automatic Differentiation Benchmarks

11.1 Forward Latency

Measure the time required to compute an operation's output.

11.2 Backward Latency

Measure the time required to compute gradients.

11.3 Total Training-Step Latency

[ T_{\text{step}}= T_{\text{forward}}+ T_{\text{loss}}+ T_{\text{backward}}+ T_{\text{optimizer}} ]

11.4 Benchmark Recommendations

  • Measure forward and backward separately.
  • Use identical computation graphs.
  • Control gradient accumulation.
  • Exclude one-time graph construction only when the workload definition permits it.
  • Validate gradients against a reference.

11.5 Important Distinction

A forward-only benchmark does not measure training performance.


12. Neural Network Benchmarks

12.1 Recommended Model Families

  • Multilayer perceptrons.
  • Convolutional networks.
  • Recurrent networks.
  • Attention-based models.
  • Transformer encoders.

12.2 Model Metadata

Record:

  • Architecture.
  • Parameter count.
  • Batch size.
  • Input dimensions.
  • Output dimensions.
  • Dtype.
  • Device.

12.3 Inference Latency

[ T_{\text{inference}}= T_{\text{forward}} ]

12.4 Inference Throughput

[ Throughput= \frac{N_{\text{samples}}}{T_{\text{elapsed}}} ]

12.5 Fair Comparisons

Ensure competing implementations use equivalent mathematical operations and execution conditions.


13. Training Throughput

13.1 Samples per Second

[ Throughput= \frac{\text{Processed Samples}}{\text{Elapsed Seconds}} ]

13.2 Steps per Second

[ StepsPerSecond= \frac{\text{Completed Steps}}{\text{Elapsed Seconds}} ]

13.3 Epoch Duration

[ T_{\text{epoch}}= \sum_{i=1}^{B}T_i ]

where (B) is the number of batches.

13.4 Example Calculation

Suppose:

  • 10,000 samples are processed.
  • Total elapsed time is 25 seconds.

Then:

[ Throughput=\frac{10000}{25}=400 ]

Result:

400 samples per second.

This is an illustrative calculation.

13.5 Report Data Loading

Clearly state whether the measurement includes data loading and preprocessing.


14. Optimizer Benchmarks

14.1 Supported Optimizer Families

EveryO includes:

  • SGD.
  • Momentum.
  • Nesterov.
  • Adam.
  • AMSGrad.

14.2 Measurements

  • Optimizer step latency.
  • Memory overhead.
  • Convergence behavior.
  • Numerical stability.

14.3 Fair Comparison

Optimizer speed should be evaluated using the same parameter count and gradient shapes.

14.4 Convergence Comparison

A faster optimizer step does not necessarily imply faster convergence.

Report both computational cost and optimization outcomes.


15. Data Pipeline Benchmarks

15.1 Measurements

  • Dataset access latency.
  • Batch creation time.
  • Samples per second.
  • Preprocessing overhead.

15.2 Separate Components

Measure:

  1. Raw data access.
  2. Preprocessing.
  3. Batching.
  4. Training computation.

15.3 Data Integrity

Performance improvements must not change sample-label alignment or silently omit records.

15.4 Reproducibility

Use identical datasets and batch sizes across comparisons.


16. Memory Profiling

16.1 Memory Categories

  • Tensor storage.
  • Gradient storage.
  • Model parameters.
  • Optimizer state.
  • Intermediate activations.
  • Data batches.

16.2 Tensor Storage Estimate

For a dense tensor:

[ MemoryBytes= N_{\text{elements}}\times BytesPerElement ]

16.3 Example

For a float32 tensor of shape (1024, 1024):

[ Memory= 1024\times1024\times4 ]

[ Memory=4,194,304\text{ bytes} ]

Approximately:

4 MiB of raw tensor data.

This excludes object overhead, gradients, temporary arrays, and allocator behavior.

16.4 Measurement Tools

Use appropriate system or Python memory profiling tools.

Clearly distinguish:

  • Process resident memory.
  • Python-managed allocations.
  • NumPy native allocations.
  • GPU device memory.

17. CPU Performance

17.1 CPU Benchmark Variables

Record:

  • CPU architecture.
  • Physical cores.
  • Logical threads.
  • BLAS threading.
  • Input sizes.
  • Dtype.

17.2 Threading Effects

BLAS libraries may use multiple CPU threads.

Different thread settings can significantly affect matrix multiplication performance.

17.3 Control Thread Counts

For controlled experiments, configure thread-related environment variables before importing NumPy.

Example:

OMP_NUM_THREADS=1 python benchmarks/benchmark_matmul.py --sizes 128 512

17.4 Interpretation

A single-thread benchmark and a multithread benchmark answer different performance questions.

Do not combine them without explanation.


18. CUDA Performance

18.1 Existing CUDA Scope

EveryO documents a small native CUDA kernel implementation.

GPU benchmarking should focus on operations actually supported by that implementation.

18.2 Distinguish Timing Types

Kernel latency: Device execution time.

Transfer latency: Host-to-device and device-to-host movement.

End-to-end latency: Complete operation including relevant transfers.

18.3 GPU Synchronization

For asynchronous execution, synchronize appropriately before recording elapsed time.

18.4 GPU Speedup

[ Speedup= \frac{T_{\text{CPU}}}{T_{\text{GPU}}} ]

18.5 Example

If a CPU operation hypothetically takes 100 ms and a GPU operation takes 25 ms:

[ Speedup=4 ]

This is an illustrative 4× speedup calculation, not a measured EveryO result.

18.6 Required Validation

  • Confirm CUDA availability.
  • Verify output correctness.
  • Record GPU model.
  • Report transfer inclusion.
  • Test on actual hardware.

19. Mixed Precision Benchmarks

19.1 Compare Precision Modes

Where supported, compare:

  • Float32.
  • Mixed float16/float32 execution.

19.2 Measurements

  • Runtime.
  • Memory.
  • Numerical error.
  • Gradient stability.

19.3 Numerical Comparison

Use an appropriate float32 reference.

19.4 CPU Caveat

Mixed precision is not guaranteed to improve performance on CPU.

NumPy may perform float16 arithmetic through higher-precision internal operations.

19.5 Report Stability

Do not report speed improvements without also assessing numerical behavior.


20. Quantization Benchmarks

20.1 Existing Functionality

EveryO provides dynamic quantization utilities.

Its documented implementation uses int8 weights without specialized faster int8 execution kernels.

20.2 Appropriate Metrics

  • Model size.
  • Numerical fidelity.
  • Output differences.
  • Inference latency.

20.3 Model Size Reduction

[ Reduction= \left( 1-\frac{Size_{\text{quantized}}}{Size_{\text{original}}} \right)\times100% ]

20.4 Important Limitation

Smaller weights do not automatically produce faster inference.

Avoid claiming quantization speedups unless they are directly measured.


21. Distributed Training Benchmarks

21.1 Scaling Objective

Measure the performance impact of multiple workers.

21.2 Speedup

[ S(p)=\frac{T(1)}{T(p)} ]

where (p) is the number of workers.

21.3 Scaling Efficiency

[ E(p)=\frac{S(p)}{p}\times100% ]

21.4 Example

Suppose:

  • Single-worker time = 100 seconds.
  • Four-worker time = 40 seconds.

Then:

[ S(4)=2.5 ]

[ E(4)=62.5% ]

These are illustrative values.

21.5 Required Metadata

Record:

  • Worker count.
  • Process topology.
  • Machine count.
  • Network configuration.
  • Communication overhead.
  • Dataset partitioning.

21.6 Validation Limitation

Same-host process testing does not establish cross-machine reliability.


22. ONNX Runtime Benchmarks

22.1 Objective

Compare EveryO inference with the exported ONNX model under equivalent conditions.

22.2 Install Optional Dependencies

python -m pip install -e ".[onnx]"

22.3 Export Example

import everyo as eo

model = eo.Sequential(
    eo.Linear(4, 8),
    eo.ReLU(),
    eo.Linear(8, 2),
)

model.eval()

eo.export_onnx(
    model,
    "benchmark_model.onnx",
    input_shape=(1, 4),
)

22.4 Compare

Measure:

  • EveryO inference latency.
  • ONNX Runtime latency.
  • Output differences.
  • Model load time separately.

22.5 Avoid Misleading Results

Do not include model export time in one implementation's inference latency while excluding equivalent setup from the other.

22.6 Tracing Caveat

Traced ONNX graphs may encode fixed execution paths or shape assumptions.

Benchmark only supported input configurations.


23. Numerical Accuracy

Performance and correctness must be evaluated together.

23.1 Absolute Error

[ E_{\text{abs}}=|y_{\text{test}}-y_{\text{reference}}| ]

23.2 Relative Error

[ E_{\text{rel}}= \frac{|y_{\text{test}}-y_{\text{reference}}|} {\max(\epsilon,|y_{\text{reference}}|)} ]

23.3 Recommended Comparison

NumPy provides:

import numpy as np

np.testing.assert_allclose(
    actual,
    expected,
    rtol=1e-5,
    atol=1e-7,
)

Here, actual and expected are arrays supplied by the benchmark.

The tolerances are illustrative; select values appropriate to the operation, dtype, and numerical reference.

23.4 Report Both

Every performance result involving alternative implementations should include numerical validation.


24. Performance Profiling

EveryO provides profiling functionality.

24.1 Profiling Objectives

Identify:

  • Expensive operations.
  • Unexpected execution frequency.
  • Memory-intensive stages.
  • Training bottlenecks.

24.2 Example Profiling Pattern

import everyo as eo

with eo.profile() as profiler:
    output = model(input_tensor)

print(profiler.summary())

The model and input tensor must be initialized beforehand.

24.3 Chrome Trace Export

EveryO's profiler supports Chrome trace export.

Consult the current API reference for exact export usage and compatibility.

24.4 Profiling Overhead

Profiling can alter execution timing.

Do not assume profiled execution has identical latency to uninstrumented execution.


25. Performance Regression Testing

25.1 Purpose

Detect unexpected performance degradation after code changes.

25.2 Baseline

Record performance from a known commit.

25.3 Candidate

Run the same workload against the proposed change.

25.4 Regression Formula

[ Regression%= \frac{T_{\text{candidate}}-T_{\text{baseline}}} {T_{\text{baseline}}}\times100% ]

25.5 Example

If baseline latency is 20 ms and candidate latency is 24 ms:

[ Regression=20% ]

This is an illustrative calculation.

25.6 Recommended Practice

Investigate regressions using repeated runs and equivalent environments.

A small difference within normal measurement noise should not automatically be treated as a confirmed regression.


26. Benchmark Reporting

26.1 Recommended Report Template

# EveryO Benchmark Report

## 1. Summary

Describe the benchmark objective.

## 2. Environment

- EveryO version:
- Git commit:
- Python version:
- NumPy version:
- Operating system:
- CPU:
- GPU:
- RAM:

## 3. Workload

- Operation:
- Input shape:
- Dtype:
- Device:
- Batch size:

## 4. Methodology

- Warm-up iterations:
- Measured iterations:
- Synchronization method:
- Timing method:

## 5. Results

| Metric | Value |
|---|---|
| Median latency | |
| Mean latency | |
| P95 latency | |
| Throughput | |
| Peak memory | |

## 6. Numerical Validation

- Reference:
- Absolute error:
- Relative error:
- Tolerance:
- Result:

## 7. Limitations

Describe limitations.

## 8. Reproduction

Provide exact commands.

26.2 Required Evidence

Benchmark reports should include reproducible commands and environment details.

26.3 Raw Data

Provide raw timing samples when practical.

26.4 Interpretation

Clearly separate observations from explanations and hypotheses.


27. Common Benchmarking Mistakes

Mistake Problem Better Practice
One timing sample Unreliable result Repeat measurements
No warm-up Startup effects Use warm-up iterations
Different tensor shapes Invalid comparison Match workloads
Different precision Misleading speed comparison Report dtype
Missing GPU synchronization Incorrect timing Synchronize
Ignoring transfer time Incomplete performance picture Report timing scope
No correctness check Fast but incorrect result Validate outputs
Unreported hardware Poor reproducibility Record specifications
Cherry-picked results Biased conclusions Report distributions
Missing software versions Hard to reproduce Record dependencies
Confusing FLOPS and FLOPs Unit ambiguity Label operations and rates
Comparing unequal models Invalid conclusions Match architecture and workload

28. Acceptance Criteria

A benchmark should be considered suitable for publication when:

  • The workload is clearly defined.
  • Hardware is documented.
  • Software versions are recorded.
  • Inputs are reproducible.
  • Warm-up is performed where appropriate.
  • Multiple measurements are collected.
  • Results include statistical summaries.
  • Numerical correctness is verified.
  • Timing scope is explicit.
  • Raw results are retained where practical.
  • Limitations are disclosed.
  • Reproduction commands are provided.

No universal latency or throughput threshold is imposed by this guide.


29. Benchmark Submission Guidelines

Community benchmark contributions are welcome.

29.1 Before Submission

  • Confirm the benchmark runs.
  • Verify correctness.
  • Record environment metadata.
  • Avoid unsupported performance claims.
  • Include reproducible instructions.

29.2 Pull Request Content

A benchmark pull request should explain:

  • Why the workload matters.
  • What is being measured.
  • How correctness is checked.
  • What dependencies are required.
  • Whether hardware-specific tests can be skipped.

29.3 Review Criteria

Maintainers may evaluate:

  • Reproducibility.
  • Correctness.
  • Maintainability.
  • Benchmark stability.
  • Relevance to EveryO's objectives.

29.4 No Automatic Performance Claims

A merged benchmark does not imply that EveryO outperforms other frameworks.


30. Official Resources

Resource Link
EveryO Repository GitHub
README README.md
Benchmark Scripts benchmarks/
Performance Documentation docs/performance.md
CUDA Documentation docs/cuda.md
Scaling Documentation docs/scaling.md
API Reference docs/api-reference.md
Testing GitHub Actions
Contributing CONTRIBUTING.md
NumPy numpy.org
Python python.org
ONNX Runtime onnxruntime.ai

Benchmarking Guide — Documentation Prepared

Next Recommended Page: Numerical Accuracy and Validation →

Home · Performance Optimization · Best Practices


EveryO — Open Machine Learning. Built for Developers.

Project Maintainer: @krishanth7

Open Source · MIT Licensed · Community Driven

© 2026 EveryO Contributors

Clone this wiki locally