https://github.com/copyleftdev/tax_compute

https://github.com/copyleftdev/tax_compute

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.8%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: copyleftdev
  • Language: Rust
  • Default Branch: feature/realistic-data
  • Size: 57.6 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created about 1 year ago · Last pushed about 1 year ago
Metadata Files
Readme

README.md

Tax Computation Engine

Build Status License Version Performance

A high-performance property tax computation engine optimized for modern CPU architectures, specifically tuned for the AMD Threadripper PRO 5975WX.

🚀 Performance

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.

📋 Features

  • 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

🔧 System Requirements

  • 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

📥 Installation

Prerequisites

```bash

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 ```

Building

```bash

Clone the repository

git clone https://github.com/yourusername/taxcompute.git cd taxcompute

Build in release mode

cargo build --release ```

Running Tests

```bash

Run unit tests

cargo test

Run benchmarks

cargo bench ```

💻 Usage

Basic Usage

```rust use taxcompute::compute::computetaxes; use taxcompute::data::{PropertyData, generaterules};

// Generate or load property data let data = PropertyData::generate(1000000); // 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 totaltax: f64 = taxes.iter().sum(); println!("Total tax: ${:.2}", totaltax); ```

Command Line Tools

The repository includes several binaries for testing and benchmarking:

```bash

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 ```

🏗️ Architecture

Project Structure

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

Key Components

  1. Computation Engine: The core compute_taxes function processes property data using SIMD and multi-threading.

  2. Data Structures:

    • PropertyData: A structure-of-arrays (SoA) layout for improved memory access patterns
    • RulesCache: A high-performance hash map for tax rule lookups
  3. Optimization Features:

    • Thread pool management
    • Dynamic chunk sizing
    • SIMD processing with the wide crate and direct AVX2 intrinsics
    • Cache-efficient memory access patterns

📊 Performance Optimization

The system implements several key optimization strategies:

1. SIMD Vectorization

Uses AVX2 instructions to process 4 double-precision values simultaneously.

2. Thread Pool Management

Configures an optimal thread pool for the target hardware: rust rayon::ThreadPoolBuilder::new() .num_threads(64) // Threadripper 5975WX has 64 logical threads .stack_size(8 * 1024 * 1024) .build_global()

3. Cache-Aware Chunking

Determines optimal chunk sizes based on dataset size and CPU cache hierarchy: rust 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.

📝 Documentation

Additional documentation includes:

🛠️ Development

Adding New Tax Rules

To add new tax rules, modify the generate_rules function in data.rs:

```rust pub fn generaterules() -> RulesCache { let mut rules = rustchash::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

} ```

Adding New Property Types

To add new property types, extend the PropertyType enum in data.rs:

rust pub enum PropertyType { Residential, Commercial, Industrial, Agricultural, // Add new property types here MixedUse, // ... }

🧪 Testing

Run the full test suite with:

```bash

Unit tests

cargo test

Integration tests

cargo test --test '*'

Benchmarks

cargo bench ```

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

👥 Contributors

  • Your Name - Initial work and optimizations

🙏 Acknowledgments

  • The Rust community for excellent parallel processing tools
  • The wide crate for portable SIMD operations

Owner

  • Name: Donald Johnson
  • Login: copyleftdev
  • Kind: user
  • Location: Los Angeles

GitHub Events

Total
  • Watch event: 1
  • Push event: 1
  • Create event: 2
Last Year
  • Watch event: 1
  • Push event: 1
  • Create event: 2

Dependencies

Cargo.lock cargo
  • aho-corasick 1.1.3
  • android-tzdata 0.1.1
  • android_system_properties 0.1.5
  • anes 0.1.6
  • anstyle 1.0.10
  • autocfg 1.4.0
  • bumpalo 3.17.0
  • bytemuck 1.23.0
  • cast 0.3.0
  • cc 1.2.22
  • cfg-if 1.0.0
  • chrono 0.4.41
  • ciborium 0.2.2
  • ciborium-io 0.2.2
  • ciborium-ll 0.2.2
  • clap 4.5.37
  • clap_builder 4.5.37
  • clap_lex 0.7.4
  • core-foundation-sys 0.8.7
  • criterion 0.5.1
  • criterion-plot 0.5.0
  • crossbeam-deque 0.8.6
  • crossbeam-epoch 0.9.18
  • crossbeam-utils 0.8.21
  • crunchy 0.2.3
  • either 1.15.0
  • half 2.6.0
  • hermit-abi 0.5.1
  • iana-time-zone 0.1.63
  • iana-time-zone-haiku 0.1.2
  • is-terminal 0.4.16
  • itertools 0.10.5
  • itoa 1.0.15
  • js-sys 0.3.77
  • libc 0.2.172
  • log 0.4.27
  • memchr 2.7.4
  • num-traits 0.2.19
  • once_cell 1.21.3
  • oorandom 11.1.5
  • plotters 0.3.7
  • plotters-backend 0.3.7
  • plotters-svg 0.3.7
  • proc-macro2 1.0.95
  • quote 1.0.40
  • rayon 1.10.0
  • rayon-core 1.12.1
  • regex 1.11.1
  • regex-automata 0.4.9
  • regex-syntax 0.8.5
  • rustc-hash 1.1.0
  • rustversion 1.0.20
  • ryu 1.0.20
  • safe_arch 0.7.4
  • same-file 1.0.6
  • serde 1.0.219
  • serde_derive 1.0.219
  • serde_json 1.0.140
  • shlex 1.3.0
  • syn 2.0.101
  • tinytemplate 1.2.1
  • unicode-ident 1.0.18
  • walkdir 2.5.0
  • wasm-bindgen 0.2.100
  • wasm-bindgen-backend 0.2.100
  • wasm-bindgen-macro 0.2.100
  • wasm-bindgen-macro-support 0.2.100
  • wasm-bindgen-shared 0.2.100
  • web-sys 0.3.77
  • wide 0.7.32
  • winapi-util 0.1.9
  • windows-core 0.61.0
  • windows-implement 0.60.0
  • windows-interface 0.59.1
  • windows-link 0.1.1
  • windows-result 0.3.2
  • windows-strings 0.4.0
  • windows-sys 0.59.0
  • windows-targets 0.52.6
  • windows_aarch64_gnullvm 0.52.6
  • windows_aarch64_msvc 0.52.6
  • windows_i686_gnu 0.52.6
  • windows_i686_gnullvm 0.52.6
  • windows_i686_msvc 0.52.6
  • windows_x86_64_gnu 0.52.6
  • windows_x86_64_gnullvm 0.52.6
  • windows_x86_64_msvc 0.52.6
Cargo.toml cargo
  • criterion 0.5 development
  • chrono 0.4.31
  • rayon 1.10
  • rustc-hash 1.1
  • wide 0.7.15