A high-performance property tax computation engine optimized for modern CPU architectures, specifically tuned for the AMD Threadripper PRO 5975WX.
This system can process property tax calculations at exceptional speeds:
- 1.81 billion properties per second peak processing rate
- 50 million properties processed in 27.61 milliseconds
- Excellent scaling characteristics across dataset sizes
For detailed performance metrics, see performance_report.md.
- SIMD-Accelerated Computation: Leverages AVX2 vector instructions for parallel processing
- Multi-threaded Processing: Optimized for 64 logical cores on Threadripper
- Cache-Aware Algorithms: Carefully tuned chunk sizes for L1/L2/L3 cache hierarchy
- Parallel Data Generation: High-throughput property data creation
- Realistic Tax Rules: Comprehensive model of actual property tax assessment
- CPU: AMD Threadripper PRO 5975WX or similar CPU with AVX2 support
- RAM: 32GB+ recommended (251GB used in benchmark system)
- OS: Linux (tested on Ubuntu 22.04)
- Rust: 1.72.0 or newer
# Install Rust if not already installed
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Required system dependencies
sudo apt-get update
sudo apt-get install build-essential
# Clone the repository
git clone https://github.com/yourusername/tax_compute.git
cd tax_compute
# Build in release mode
cargo build --release
# Run unit tests
cargo test
# Run benchmarks
cargo bench
use tax_compute::compute::compute_taxes;
use tax_compute::data::{PropertyData, generate_rules};
// Generate or load property data
let data = PropertyData::generate(1_000_000); // 1 million properties
// Generate or load tax rules
let rules = generate_rules();
// Compute taxes (utilizes all available optimizations)
let taxes = compute_taxes(&data, &rules);
// Process results
let total_tax: f64 = taxes.iter().sum();
println!("Total tax: ${:.2}", total_tax);
The repository includes several binaries for testing and benchmarking:
# Run the standard tax computation process
cargo run --release --bin tax_compute
# Run the performance test suite
cargo run --release --bin performance_test
# Run the profiling analysis
cargo run --release --bin profile_analysis
tax_compute/
├── src/
│ ├── bin/ # Binaries and utilities
│ │ ├── performance_test.rs
│ │ └── profile_analysis.rs
│ ├── compute.rs # Core computation engine
│ ├── data.rs # Data structures and generators
│ ├── profiling.rs # Performance monitoring tools
│ ├── tax_records.rs # Record definitions
│ ├── lib.rs # Library exports
│ └── main.rs # Main binary entry point
├── benches/ # Benchmarks
├── build.rs # Build script
├── Cargo.toml # Dependencies and project config
└── README.md # This file
-
Computation Engine: The core
compute_taxes
function processes property data using SIMD and multi-threading. -
Data Structures:
PropertyData
: A structure-of-arrays (SoA) layout for improved memory access patternsRulesCache
: A high-performance hash map for tax rule lookups
-
Optimization Features:
- Thread pool management
- Dynamic chunk sizing
- SIMD processing with the
wide
crate and direct AVX2 intrinsics - Cache-efficient memory access patterns
The system implements several key optimization strategies:
Uses AVX2 instructions to process 4 double-precision values simultaneously.
Configures an optimal thread pool for the target hardware:
rayon::ThreadPoolBuilder::new()
.num_threads(64) // Threadripper 5975WX has 64 logical threads
.stack_size(8 * 1024 * 1024)
.build_global()
Determines optimal chunk sizes based on dataset size and CPU cache hierarchy:
fn determine_optimal_chunk_size(data_size: usize) -> usize {
if data_size < 10_000 {
return 1024; // Small datasets
} else {
return 16384; // Medium to large datasets (optimal for L2/L3 cache)
}
}
For detailed optimization information, see the performance guide.
Additional documentation includes:
- Performance Report: Comprehensive analysis of system performance
- Performance Guide: Guide to optimization techniques
- Flamegraph Guide: Instructions for generating flame graphs
- Cachegrind Guide: Guide to cache analysis
To add new tax rules, modify the generate_rules
function in data.rs
:
pub fn generate_rules() -> RulesCache {
let mut rules = rustc_hash::FxHashMap::default();
// Add a new tax rule
rules.insert(RuleKey(new_jurisdiction_id), TaxRule {
millage_rate: 25.5,
homestead_exemption: 50000.0,
senior_exemption_pct: 0.25,
// Additional parameters...
});
rules
}
To add new property types, extend the PropertyType
enum in data.rs
:
pub enum PropertyType {
Residential,
Commercial,
Industrial,
Agricultural,
// Add new property types here
MixedUse,
// ...
}
Run the full test suite with:
# Unit tests
cargo test
# Integration tests
cargo test --test '*'
# Benchmarks
cargo bench
This project is licensed under the MIT License - see the LICENSE file for details.
- Your Name - Initial work and optimizations
- The Rust community for excellent parallel processing tools
- The
wide
crate for portable SIMD operations