# simplemage/module-indexer-benchmark

> SimpleMage Indexer Benchmark — dev-only verification harness for SimpleMage_CategoryProductIndexer: before/after benchmark commands, metric collectors, MD5 correctness verification. Staging/dev use only.

`composer require simplemage/module-indexer-benchmark`

Canonical URL: https://packagento.com/simplemage/module-indexer-benchmark

## At a glance

- **Vendor**: simplemage (https://packagento.com/simplemage.md)
- **Latest version**: v1.0.0 — released 2026-06-12
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/simplemage/module-indexer-benchmark and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require simplemage/module-indexer-benchmark:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

SimpleMage Indexer Benchmark — dev-only verification harness for SimpleMage_CategoryProductIndexer: before/after benchmark commands, metric collectors, MD5 correctness verification. Staging/dev use only.

## README

Dev-only companion module for **SimpleMage_CategoryProductIndexer**. It measures
the before/after performance of the `catalog_category_product` indexer on YOUR
database and **proves the index output is byte-for-byte identical** to core
Magento - every row, every column, every store view, MD5-compared.

> ⚠️ **Staging / development environments only.** This module resets indexer
> state, flushes caches and dumps index tables. Never install it on production.
> Nothing ever leaves your server - all results are local files under
> `var/simplemage-bench/`.

### Requirements

- Magento Open Source 2.4.6 - 2.4.9 or Mage-OS 1.x - 3.x, PHP 8.2 - 8.5
- A staging copy of your store database (the bigger the catalog, the better)
- The `SimpleMage_CategoryProductIndexer` module files in `app/code/` (disabled at first!)

### Beta test - 5 steps

```bash
## 0. Install the harness (SimpleMage_CategoryProductIndexer stays DISABLED for now)
bin/magento module:enable SimpleMage_IndexerBenchmark
bin/magento setup:upgrade && bin/magento setup:di:compile

## 1. BASELINE - measure core Magento on your data
bin/magento simplemage:bench:run -i catalog_category_product -m baseline
bin/magento simplemage:bench:snapshot -i catalog_category_product -l core

## 2. Enable the SimpleMage indexer module
bin/magento module:enable SimpleMage_CategoryProductIndexer
bin/magento setup:upgrade && bin/magento setup:di:compile

## 3. CANDIDATE - measure the SimpleMage path on the same data
bin/magento simplemage:bench:run -i catalog_category_product -m candidate
bin/magento simplemage:bench:snapshot -i catalog_category_product -l simplemage -d core

## 4. Full report: timings + byte-identity verdict
bin/magento simplemage:bench:compare -i catalog_category_product \
    --snapshot-baseline=core --snapshot-candidate=simplemage
```

**That's it.** Step 3's `-d core` already prints the MD5 verdict
(`Snapshots MATCH` / `DIFFER`); step 4 adds the side-by-side metric table.
Please send us the full console output of step 4 (and step 3 if it reported
`DIFFER`).

> 🔒 Do not change the catalog between step 1 and step 3 (disable cron) -
> any product/category change in between produces a false DIFFER.

### Optional: partial-reindex benchmark

Partial (MView) reindex is the production hot path - worth measuring too.
The same seed guarantees baseline and candidate use the identical ID sample:

```bash
## before enabling the module:
bin/magento simplemage:bench:run-partial -i catalog_product_category -c 100 -m baseline
## after enabling:
bin/magento simplemage:bench:run-partial -i catalog_product_category -c 100 -m candidate
```

### Commands

| Command | Purpose |
|---|---|
| `simplemage:bench:run -i <indexer> -m baseline\|candidate [-l label] [--skip-reset]` | Full reindex with metric collection (wall clock, peak memory, SQL query count/time, slow queries, lock waits, tmp disk tables) |
| `simplemage:bench:snapshot -i <indexer> -l <label> [-d <other-label>]` | Deterministic full-content dump of the live index tables; with `-d`, saves AND diffs against an earlier label (MD5 + line diff) |
| `simplemage:bench:compare -i <indexer> [-l label] [--snapshot-baseline=A --snapshot-candidate=B] [--strict] [--threshold=10]` | Baseline vs candidate metric table, regression flags, optional snapshot verdict |
| `simplemage:bench:run-partial -i <indexer> -c <n> -m <mode> [--seed 42] [--ids 1,2,3]` | Partial reindex (`reindexList`) benchmark on a deterministic ID sample |

### How the correctness check works

`simplemage:bench:snapshot` dumps **every row of every
`catalog_category_product_index_store*` table** (the live, post-switch tables -
excluding `_replica`/`_tmp`/`_outdated`) in canonical order with all columns
serialised per line, then compares files via streaming MD5. A `MATCH` means the
SimpleMage indexer produced literally identical data to core on your catalog.
No sampling, no aggregation limits, table-prefix aware.

### License

MIT - see [LICENSE](LICENSE).

## Recent Versions

| Version | Released |
|---|---|
| v1.0.0 | 2026-06-12 |

## Dependencies

### Require

| Package | Constraint |
|---|---|
| magento/framework | >=103.0.6 |
| magento/module-catalog | >=104.0.6 |
| magento/module-indexer | >=100.4.6 |
| php | ~8.2.0 \|\| ~8.3.0 \|\| ~8.4.0 \|\| ~8.5.0 |

### Suggest

| Package | Constraint |
|---|---|
| simplemage/module-category-product-indexer | The indexer rewrite this harness benchmarks and verifies (baseline mode works on plain core without it) |

## Quality

Latest release (v1.0.0) fails the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Pass | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | Pass | Pass |


### Code Quality

Advisory checks against the module's source. Never affect the Compatibility verdict — a phpcs finding can't make a module incompatible.

#### Static Analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Fail | 64 | 3 errors, 61 warnings (ruleset: Magento2), 1 auto-fixable with phpcbf |
| PHPMD | Warning | 26 | 26 rule violations (UnusedPrivateField:26) |
| Cpd | Pass | 0 |  |
| Composer validate | Info | 3 | valid; 3 advisory notes (composer validate --strict) |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | 7 | 7 | – | – |
| 2.4.8 | – | 7 | 7 | – |
| 2.4.9 | – | – | 7 | 7 |


### Tests

Unit and integration suites run per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### Unit Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |

#### Integration Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |


### Security

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | Pass | 0 |  |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["simplemage/module-indexer-benchmark"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

simplemage is a Magento 2 vendor on Packagento. See https://packagento.com/simplemage.md for their full catalogue.

