Thank you for your interest in contributing to the NanoID Java Benchmark project! This document provides guidelines and information for contributors.
By participating in this project, you agree to abide by our code of conduct. Please be respectful and professional in all interactions.
- JDK 17 or higher
- Apache Maven 3.6.0 or higher
- Git
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/nanoid-java-benchmark.git cd nanoid-java-benchmark - Add the upstream repository:
git remote add upstream https://github.com/albahrani/nanoid-java-benchmark.git
- Build the project:
mvn clean compile
- Check the issue tracker to see if your feature/bug is already being worked on
- For large changes, consider opening an issue first to discuss the approach
-
Create a new branch for your feature/fix:
git checkout -b feature/your-feature-name
-
Make your changes following the coding standards below
-
Test your changes:
mvn clean compile mvn exec:java -Dexec.args="-f 1 -wi 1 -i 1" -
Commit your changes with a clear commit message:
git commit -m "Add feature: description of your changes" -
Push to your fork:
git push origin feature/your-feature-name
-
Create a Pull Request on GitHub
- Follow standard Java naming conventions
- Use meaningful variable and method names
- Add JavaDoc comments for public methods and classes
- Keep methods focused and small
- Use proper indentation (4 spaces)
- Use appropriate JMH annotations
- Set reasonable warmup and measurement iterations
- Use
@State(Scope.Benchmark)for shared state - Include meaningful benchmark names that describe what's being tested
- Add comments explaining complex benchmark setups
/**
* Benchmark for generating NanoIDs with custom alphabet.
* Tests performance with a reduced character set.
*/
@Benchmark
public String generateCustomAlphabetNanoId() {
return NanoId.customNanoid("0123456789abcdef", 16);
}When adding new benchmark scenarios:
- Ensure the benchmark tests a meaningful use case
- Use appropriate JMH configuration
- Update the README.md to document the new benchmark
- Include the benchmark in the summary table
- Fix typos and grammar issues
- Add examples and clarifications
- Update outdated information
- Translate documentation (if applicable)
- Include a clear description of the bug
- Add test cases that reproduce the issue
- Ensure the fix doesn't break existing functionality
- Provide benchmark results showing the improvement
- Explain the optimization approach
- Ensure the changes don't affect benchmark accuracy
# Compile the project
mvn clean compile
# Run a quick benchmark test
mvn exec:java -Dexec.args="-f 1 -wi 1 -i 1"
# Run full benchmarks (takes longer)
mvn exec:java- Include benchmark results in your PR description for performance-related changes
- Use consistent testing environments when comparing results
- Run benchmarks multiple times to ensure consistency
-
Update documentation: Ensure any changes are reflected in the README.md and other relevant documentation
-
Add/update tests: Include appropriate benchmark tests for new features
-
Clean commit history: Squash commits if necessary to maintain a clean history
-
Fill out PR template: Provide a clear description of your changes
-
Respond to feedback: Address any review comments promptly
When reporting issues:
- Use a clear and descriptive title
- Provide steps to reproduce the issue
- Include system information (OS, Java version, Maven version)
- Include relevant benchmark output or error messages
- Open an issue for questions about the project
- Check existing issues and discussions before asking
- Be specific about what you're trying to achieve
Contributors will be acknowledged in the project. Significant contributions may result in collaborator access.
Thank you for contributing to NanoID Java Benchmark!