This document describes the automated benchmark system that runs daily benchmarks across multiple Node.js versions and automatically updates the repository with the latest results.
The automated benchmark system consists of:
- GitHub Actions Workflow (
.github/workflows/daily-benchmarks.yml) - README Update Script (
scripts/update-readme.js) - Automated Git Commits (via GitHub Actions bot)
The workflow runs automatically every day at 2:00 AM UTC via GitHub Actions cron schedule:
schedule:
- cron: '0 2 * * *'Benchmarks are executed in parallel across multiple Node.js versions:
- Node.js 18 (Legacy LTS)
- Node.js 20 (Active LTS - Recommended)
- Node.js 22 (Current)
- Node.js 24 (Latest)
- Node.js latest (Most recent release)
- Checkout Repository: Clones the latest code from the main branch
- Setup Node.js: Configures each Node.js version in parallel jobs
- Install Dependencies: Installs build tools and npm packages
- Run Benchmarks: Executes
npm run benchmarkfor each version - Upload Artifacts: Saves benchmark JSON results as artifacts
- Consolidate Results: Downloads all artifacts and consolidates them
- Update README: Runs the update script to generate markdown tables
- Commit Changes: Automatically commits and pushes updated files
The scripts/update-readme.js script:
- Reads all
benchmark_results_node_*.jsonfiles - Generates comprehensive markdown tables for each configuration
- Adds performance comparison summaries
- Identifies best performers by operation type
- Updates the README between
<!-- BENCHMARK_RESULTS_START -->and<!-- BENCHMARK_RESULTS_END -->markers
The following files are automatically updated and committed:
benchmark_results_node_v18.*.json- Node.js 18 resultsbenchmark_results_node_v20.*.json- Node.js 20 resultsbenchmark_results_node_v22.*.json- Node.js 22 resultsbenchmark_results_node_v24.*.json- Node.js 24 resultsbenchmark_results_node_v*.*.json- Node.js latest resultsREADME.md- Updated with latest benchmark tables
You can manually trigger the workflow in two ways:
- Go to the Actions tab in the GitHub repository
- Select Daily SQLite Benchmarks workflow
- Click Run workflow button
- Select the branch and click Run workflow
gh workflow run daily-benchmarks.ymlThe workflow also runs automatically when you push changes to:
benchmark.js.github/workflows/daily-benchmarks.yml
The workflow requires the following permissions:
- contents: write - To commit and push updated benchmark results
These permissions are configured in the workflow file and should be automatically granted by GitHub Actions.
Automated commits use the following format:
chore: update benchmark results [skip ci]
The [skip ci] tag prevents the workflow from triggering itself recursively.
Problem: The workflow runs but doesn't commit changes.
Solution: Ensure the repository settings allow GitHub Actions to create and approve pull requests:
- Go to Settings → Actions → General
- Under Workflow permissions, select Read and write permissions
- Check Allow GitHub Actions to create and approve pull requests
Problem: Benchmarks fail with native module compilation errors.
Solution: The workflow automatically installs build dependencies. If issues persist, check:
- Node.js version compatibility with
better-sqlite3-multiple-ciphers - Ubuntu build tools are properly installed in the workflow
Problem: Some Node.js versions don't produce results.
Solution: The workflow uses continue-on-error: true for benchmark steps to allow partial results. Check the workflow logs to see which versions failed and why.
Edit the cron expression in .github/workflows/daily-benchmarks.yml:
schedule:
# Run every 6 hours
- cron: '0 */6 * * *'
# Run weekly on Monday at 3 AM
- cron: '0 3 * * 1'
# Run on the 1st of every month
- cron: '0 0 1 * *'Edit the matrix in .github/workflows/daily-benchmarks.yml:
strategy:
matrix:
node-version: [18, 20, 22, 23, 24, 'latest']Edit scripts/update-readme.js to change:
- Table formatting
- Performance analysis
- Best performer calculations
- Additional metrics or charts
┌─────────────────────────────────────────────────────────────┐
│ GitHub Actions Workflow │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Node 18 │ │ Node 20 │ │ Node 22 │ ... │
│ │ Benchmark │ │ Benchmark │ │ Benchmark │ │
│ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │
│ │ │ │ │
│ └─────────────────┴─────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ Consolidate │ │
│ │ Artifacts │ │
│ └────────┬────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ Update README │ │
│ │ (Node script) │ │
│ └────────┬────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ Git Commit │ │
│ │ & Push │ │
│ └─────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
- Always Up-to-Date: Benchmark results reflect the latest code changes
- Multi-Version Testing: Identifies performance regressions across Node.js versions
- Zero Maintenance: Fully automated with no manual intervention required
- Historical Tracking: Git history preserves all benchmark results over time
- Transparent: All results are visible in the repository
- CI/CD Integration: Workflow can be extended to block merges on performance regressions
Potential improvements to consider:
- Add performance regression detection (fail if performance drops >10%)
- Generate performance trend charts over time
- Send notifications on significant performance changes
- Add more detailed system information (CPU, RAM, disk specs)
- Create a separate
BENCHMARKS.mdfile for historical data - Add comparison with other SQLite libraries
- Implement benchmark result caching to avoid redundant runs
This automation system is part of the sqlite-benchmarks project and follows the same license.