🌀 Whirlwind
An asynchronous, sharded HashMap for high-performance concurrent data access
in Rust.
[!NOTE] This crate is in development, and breaking changes may be made up until a 1.0 release.
📖 Table of Contents
✨ Features
- Async Ready: Seamless integration with Rust's
async/awaitsyntax. - High Performance: Sharding minimizes lock contention in concurrent environments.
- Thread-safe: Safe for use across multiple threads without fear of data races.
- Familiar API: Intuitive
HashMap-like interface for ease of adoption. - Customizable Shards: Configure the number of shards to optimize for your workload.
📦 Installation
Add whirlwind to your Cargo.toml:
[]
= "0.1.1"
🔧 Usage
Here's a quick example to get you started:
use ShardMap;
async
📚 Examples
Concurrent Inserts
use ShardMap;
use JoinSet;
async
Custom Shard Count
use ShardMap;
async
📊 Benchmarks
Benchmarks were run in a asyncified version of this benchmark. You can
find it here. Since the benchmarks use jonhoo/bustle,
an asyncified fork of that library (here) is required.
Machine: Apple M3 Max (2023 16-inch MacBook Pro, 36GB RAM)
OS: macOS 15.0
See the results/ directory.
Read Heavy (std hasher)
Exchange (std hasher)
Rapid Grow (std hasher)
Read Heavy (ahash)
Exchange (ahash)
Rapid Grow (ahash)
🤝 Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature. - Commit your changes:
git commit -am 'Add your feature'. - Push to the branch:
git push origin feature/your-feature. - Open a pull request.
Running Tests
Ensure all tests pass before submitting a PR:
Code Style
We use rustfmt for code formatting:
License
Copyright 2024 Will Hopkins
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Made with 💖 and Rust.