Skip to content

Conversation

@abnegate
Copy link
Member

@abnegate abnegate commented Dec 8, 2025

No description provided.

@github-actions
Copy link

github-actions bot commented Dec 16, 2025

Benchmark Results

Swoole Adapters (Sync, Swoole Thread, Swoole Process, Amp, React)

╔══════════════════════════════════════════════════════════════════════════════╗
║                    Parallel Adapter Benchmark                                ║
╚══════════════════════════════════════════════════════════════════════════════╝

System Info:
  PHP Version: 8.4.15
  Swoole Version: 6.1.3
  CPU Cores: 4
  Iterations: 10 per test
  Load: 50% (workload intensity)

Detected adapters:
  [x] Sync
  [x] Swoole Thread
  [x] Swoole Process
  [x] Amp
  [x] React
  [x] ext-parallel

┌──────────────────────────────────────────────────────────────────────────────┐
│ CPU-Intensive Workloads                                                      │
└──────────────────────────────────────────────────────────────────────────────┘

  Prime calculation (4 tasks, primes up to 200000)
--------------------------------------------------------------------------------

ext-parallel Adapter (Sync, Amp, React, ext-parallel)

╔══════════════════════════════════════════════════════════════════════════════╗
║                    Parallel Adapter Benchmark                                ║
╚══════════════════════════════════════════════════════════════════════════════╝

System Info:
  PHP Version: 8.4.15
  CPU Cores: 4
  Iterations: 10 per test
  Load: 50% (workload intensity)

Detected adapters:
  [x] Sync
  [ ] Swoole Thread
  [ ] Swoole Process
  [x] Amp
  [x] React
  [x] ext-parallel

┌──────────────────────────────────────────────────────────────────────────────┐
│ CPU-Intensive Workloads                                                      │
└──────────────────────────────────────────────────────────────────────────────┘

  Prime calculation (4 tasks, primes up to 200000)
--------------------------------------------------------------------------------
  Sync:             0.291s (std: 0.009s, range: 0.286-0.316s)
  Amp:              0.263s (std: 0.029s, range: 0.252-0.347s)  1.11x speedup
  React:            0.358s (std: 0.044s, range: 0.309-0.409s)  0.81x speedup
  ext-parallel:     0.358s (std: 0.044s, range: 0.309-0.409s)  0.81x speedup
  Winner: Amp (9.6% faster than sync)

  Matrix multiply (4 tasks, 200x200)
--------------------------------------------------------------------------------
  Sync:             1.040s (std: 0.008s, range: 1.032-1.055s)
  Amp:              0.467s (std: 0.038s, range: 0.446-0.574s)  2.23x speedup
  React:            0.548s (std: 0.043s, range: 0.517-0.610s)  1.90x speedup
  ext-parallel:     0.548s (std: 0.043s, range: 0.517-0.610s)  1.90x speedup
  Winner: Amp (55.1% faster than sync)

┌──────────────────────────────────────────────────────────────────────────────┐
│ I/O-Simulated Workloads                                                      │
└──────────────────────────────────────────────────────────────────────────────┘

  Sleep tasks (4 tasks, 50ms each)
--------------------------------------------------------------------------------
  Sync:             0.200s (std: 0.000s, range: 0.200-0.200s)
  Amp:              0.064s (std: 0.040s, range: 0.051-0.177s)  3.13x speedup
  React:            0.118s (std: 0.031s, range: 0.106-0.205s)  1.70x speedup
  ext-parallel:     0.118s (std: 0.031s, range: 0.106-0.205s)  1.70x speedup
  Winner: Amp (68.0% faster than sync)

  Mixed workload (4 tasks)
--------------------------------------------------------------------------------
  Sync:             0.124s (std: 0.001s, range: 0.123-0.127s)
  Amp:              0.061s (std: 0.033s, range: 0.051-0.156s)  2.02x speedup
  React:            0.106s (std: 0.001s, range: 0.104-0.109s)  1.17x speedup
  ext-parallel:     0.106s (std: 0.001s, range: 0.104-0.109s)  1.17x speedup
  Winner: Amp (50.4% faster than sync)

┌──────────────────────────────────────────────────────────────────────────────┐
│ Scaling Benchmarks                                                           │
└──────────────────────────────────────────────────────────────────────────────┘

  Scaling test (1 tasks)
--------------------------------------------------------------------------------
  Sync:             0.022s (std: 0.000s, range: 0.021-0.022s)
  Amp:              0.027s (std: 0.015s, range: 0.022-0.070s)  0.79x speedup
  React:            0.060s (std: 0.002s, range: 0.058-0.064s)  0.36x speedup
  ext-parallel:     0.060s (std: 0.002s, range: 0.058-0.064s)  0.36x speedup
  Winner: Amp (-26.3% faster than sync)

  Scaling test (2 tasks)
--------------------------------------------------------------------------------
  Sync:             0.041s (std: 0.000s, range: 0.041-0.042s)
  Amp:              0.032s (std: 0.028s, range: 0.022-0.111s)  1.27x speedup
  React:            0.058s (std: 0.000s, range: 0.057-0.058s)  0.72x speedup
  ext-parallel:     0.058s (std: 0.000s, range: 0.057-0.058s)  0.72x speedup
  Winner: Amp (21.3% faster than sync)

  Scaling test (4 tasks)
--------------------------------------------------------------------------------
  Sync:             0.083s (std: 0.000s, range: 0.082-0.084s)
  Amp:              0.079s (std: 0.021s, range: 0.071-0.139s)  1.05x speedup
  React:            0.137s (std: 0.032s, range: 0.126-0.227s)  0.60x speedup
  ext-parallel:     0.137s (std: 0.032s, range: 0.126-0.227s)  0.60x speedup
  Winner: Amp (4.8% faster than sync)

  Scaling test (8 tasks)
--------------------------------------------------------------------------------
  Sync:             0.165s (std: 0.000s, range: 0.165-0.166s)
  Amp:              0.154s (std: 0.021s, range: 0.145-0.214s)  1.07x speedup
  React:            0.265s (std: 0.031s, range: 0.254-0.354s)  0.62x speedup
  ext-parallel:     0.265s (std: 0.031s, range: 0.254-0.354s)  0.62x speedup
  Winner: Amp (6.6% faster than sync)
   16 tasks: Sync=0.332s, Amp=0.303s (1.1x), React=0.514s (0.6x), parallel=0.514s (0.6x)
   32 tasks: Sync=0.661s, Amp=0.584s (1.1x), React=1.024s (0.6x), parallel=1.024s (0.6x)

┌──────────────────────────────────────────────────────────────────────────────┐
│ Summary                                                                      │
└──────────────────────────────────────────────────────────────────────────────┘

  Adapter             Wins  Avg Speedup  Max Speedup
----------------------------------------------------
  Amp                   10        1.49x        3.13x
  React                  0        0.92x        1.90x
  ext-parallel           0        0.92x        1.90x

  Recommendation: Amp for best overall performance.
  Theoretical max speedup: 4x (limited by CPU cores)


Benchmarks run with 10 iterations on GitHub Actions runner

abnegate and others added 5 commits December 16, 2025 22:09
ext-parallel and Swoole are incompatible - they can't be loaded together.
Run two separate benchmarks to cover all adapters:

1. Swoole run: Sync, Swoole Thread, Swoole Process, Amp, React
2. ext-parallel run: Sync, Amp, React, ext-parallel

Results are combined and posted as separate collapsible sections in the
PR comment.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@abnegate abnegate merged commit 04c79ee into main Dec 18, 2025
18 checks passed
@abnegate abnegate deleted the feat-config branch December 18, 2025 07:25
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.

2 participants