Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/imertz/bun-sqlite-benchmark

A high-performance benchmark tool built with Bun:sqlite, designed to measure and compare the speed of insert and select operations on large datasets.
https://github.com/imertz/bun-sqlite-benchmark

benchmark bun sqlite3

Last synced: about 1 month ago
JSON representation

A high-performance benchmark tool built with Bun:sqlite, designed to measure and compare the speed of insert and select operations on large datasets.

Awesome Lists containing this project

README

        

# Bun:sqlite Benchmark

This project is a performance benchmark for SQLite operations using Bun, a fast all-in-one JavaScript runtime. It measures the speed of insert and select operations, with and without an index, on a large number of records.

## Features

- Inserts and selects a large number of records (default: 1,000,000)
- Compares performance with and without an index on the email column
- Uses worker threads for parallel processing
- Provides detailed performance metrics

## Prerequisites

- [Bun](https://bun.sh) v1.1.24 or later

## Installation

1. Clone this repository:

```bash
git clone https://github.com/yourusername/bun-sqlite-benchmark.git
cd bun-sqlite-benchmark
```

## Usage

To run the benchmark:

```bash
bun run benchmark
```

This will execute the benchmark and display the results in the console.

## Configuration

You can modify the following constants in `bun-sqlite-benchmark.js` to adjust the benchmark parameters:

- `NUM_RECORDS`: Number of records to insert (default: 1,000,000)
- `NUM_WORKERS`: Number of worker threads to use (default: number of CPU cores)
- `BATCH_SIZE`: Number of records to insert in a single transaction (default: 100)
- `LOG_INTERVAL`: Interval for logging progress (default: 100,000 records)
- `MAX_SELECT_TIME`: Maximum time for select operations (default: 10 seconds)

## Results

The benchmark will output performance metrics for insert and select operations, both with and without an index on the email column. It will also calculate the speedup percentage for select operations when using an index.

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

This project is open source and available under the [MIT License](LICENSE).