Skip to content
Daniele Penza edited this page Nov 28, 2026 · 22 revisions

⚙️ VBA Performance Manager

A source-first timing, measurement, and execution-control component for Excel VBA

Six timing backends · Monotonic high-resolution QPC · Session-bound validation · Distribution-aware statistics · Structured checkpoints · Shared Excel state suppression

Excel VBA Pure VBA QPC Regression Statistics Version


📐 At a glance

6 timing backends behind one session-bound interface
44 public members — 25 methods and 19 properties
93 regression cases and 861 assertions; published v1.4.1 result: 0 failures on 64-bit Excel (v1.4.0: 80 cases, 643 assertions)
31 named error values — 24 class and 7 companion-module errors (v1.4.1 adds ERR_TW_KEY_SPACE_EXHAUSTED, #35; v1.4.0 has 30)
31 static checks in v1.4.1, against 12 in the published v1.4.0 evidence. New ones include component inventory #82, tracked-binary review #84, Markdown links #85, VBA source rules and layout #83, README facts #89 and the six release-state rules of #50. All are independent of Excel execution
2 files to import. No reference, no add-in, no DLL

Current release assurance

Latest release: v1.4.1 Release status: published Development static checks: 31 Execution evidence: 64-bit only 32-bit follow-up: #29, v1.5.0, contributor-dependent

v1.4.1's 31 static checks are the earlier 25-check gate plus the six release-state rules of #50. They are static checks, not Excel certification: the v1.4.1 certification record is in docs/releases/v1.4.1/EVIDENCE.md and on the release page. Earlier releases' certification is unchanged, and the dated counts below remain historical.

✨ What this Wiki covers

This Wiki is the technical reference companion to the repository.

It documents:

  • the public API and the session-bound timing model;
  • the six timing backends and how to choose between them;
  • the measurement harness and statistics surface;
  • structured checkpoints and report export;
  • the shared time-waster scope model;
  • strict and non-strict error contracts;
  • the internal architecture and the reasoning behind it;
  • the regression suite and what it covers.

Important

This is a timing session manager, not a Timer() wrapper.

A backend is bound when the session starts, and every elapsed-time read is validated against that same backend. Rollover arithmetic, unsigned 32-bit conversion, timer-resolution lifecycle, and shared Excel state coordination are all handled explicitly rather than left to the caller. Backwards-clock detection is reachable only where a negative delta is not absorbed by wrap correction — backend 2 on 64-bit Office and backend 6; see Known Limitations.

Note

This wiki documents v1.4.1, released on 28 November 2026. Its tag targets 189668851754ec10e4c86d02f2e12b16739a54a5, certified with 93 cases, 861 assertions and 0 failures on Microsoft Excel 16.0.20527.20194, 64-bit. The Release package VBA-Performance-Manager-v1.4.1.zip and the provenance manifest are published on the release page, and the full certification record is in docs/releases/v1.4.1/EVIDENCE.md. Certification is 64-bit only. Source retains 32-bit branches, but real 32-bit execution remains unverified and tracked in #29 (v1.5.0, contributor-dependent).

v1.4.0, released on 31 August 2026 with tag target a5390b4c6ca56ebbd87eca121b5167ee5dc09963, keeps its published release page. What changed in v1.4.1 is summarised in Version History.


🧭 Start here

👋 New to the component?

  1. Installation and Import — two files, in the right order
  2. Quick Start — first measurement in five minutes
  3. Core API — the session model and the three members that matter
  4. Timer Methods — pick a backend and understand its limits

📊 Here to benchmark something?

🚀 Here to make a slow macro faster?

🧠 Interested in the internals?


⏱️ The shape of a measurement

Dim cPM As cPerformanceManager
Set cPM = New cPerformanceManager

cPM.StartTimer cPM_MethodQPC           'bind the QPC backend
    '... your workload ...
Debug.Print cPM.ElapsedTime            'read, validated against that backend

cPM.ResetEnvironment
Set cPM = Nothing

The shape is intentionally compact; production code should route cleanup through the safe lifecycle.

For anything you intend to draw conclusions from, measure repeatedly:

Dim S() As Double
S = cPM.MeasureProcedure("RebuildPivotCache", 30, 3)
Debug.Print cPM.Stats_Text(S, "Pivot rebuild")

Tip

Use the median as the headline, keep the minimum as the fastest observed run, and report sample count and spread. Preserve the vector so the result remains auditable. See Statistics and Measurement.


📁 Repository map

src/classes/cPerformanceManager.cls      Required — the class
src/modules/M_cPM_TIMEWASTERS.bas        Required — shared TW manager
test/M_cPM_Test.bas                      Regression suite
demo/M_cPM_DEMO.bas                      Interactive demo
demo/M_cPM_USAGE_EXAMPLES.bas            Worked examples
demo/M_DEMO_BUILDER.bas                  Presentation helpers
README.md                                Project overview
INSTALLATION.md                          Canonical install, upgrade and recovery guide
CHANGELOG.md                             Version history
SECURITY.md                              Security and trust boundaries
RELEASING.md                             Maintainer release procedure

Warning

Import M_cPM_TIMEWASTERS.bas first. The class calls PM_TW_NewInstanceKey, so importing the class alone will not compile.

Note

The demo workbook is distributed as a Release asset rather than versioned in the repository. From v1.4.1 it ships inside VBA-Performance-Manager-vX.Y.Z.zip, together with LICENSE and NOTICE. Binary Excel files do not diff, so every update would store a full copy.


📚 Full page index

Page Contents
Installation and Import Import order, compile check, optional modules
Quick Start First measurement, first checkpoint, first benchmark
Timer Methods Six backends, resolution, rollover, selection guidance
Core API Session model, StartTimer, ElapsedSeconds, ElapsedTime
Statistics and Measurement Procedure/baseline/overhead vectors, failure evidence, Stats_*
Checkpoint and Reporting Named phases, delta and cumulative, export surfaces
Time-Waster Suppression Shared scope model, masks, exemptions, recovery
Execution Control and Environment Pause strategies, ResetEnvironment
Diagnostics and Benchmark Helpers Overhead, QPC frequency, tick interval
State Inspection and Debugging T1, T2, ET, session accessors
Strict Mode and Error Behavior Strict versus non-strict, per condition
Error Handling and Strict Mode Error constants and raise policy
Architecture and Internal Design Internals and design reasoning
Benchmarking Guidance Practical measurement discipline
Testing and Validation The regression suite (93 cases in v1.4.1) and evidence boundaries
Examples and Usage Patterns Worked patterns
Known Limitations Documented boundaries
FAQ Common questions
Version History Release record

Clone this wiki locally