diff --git a/README.md b/README.md index 0a3e7c9..a82cb2c 100644 --- a/README.md +++ b/README.md @@ -160,8 +160,21 @@ Detailed performance reports are available for each decimal precision level: # Run specific language cd c && ./build.sh && ./print_hej + +# Run detailed profiling (breaks down execution time) +./profile_detailed.sh 100 ``` +## Detailed Profiling + +The benchmark includes a detailed profiling system that breaks down execution time into components: + +- **Startup Time**: Runtime initialization, library loading, JIT compilation +- **Calculation Time**: Algorithm execution, numerical operations +- **I/O Time**: Output formatting, result printing + +See [PROFILING.md](PROFILING.md) for detailed documentation. + ## License MIT License - See LICENSE file for details. diff --git a/reports/1000_decimals.md b/reports/1000_decimals.md index 2e6c609..d18470c 100644 --- a/reports/1000_decimals.md +++ b/reports/1000_decimals.md @@ -557,6 +557,54 @@ xychart-beta **Analysis:** R executes in 158ms with peak memory usage of 2,080,768 bytes (1.98 MB). + +## Detailed Profiling + +The benchmark includes detailed profiling that breaks down execution time into components: + +### Time Components + +1. **Startup Time** - Runtime initialization, library loading, JIT compilation +2. **Calculation Time** - Algorithm execution, numerical operations +3. **I/O Time** - Output formatting, result printing + +### Typical Values for 1000 Decimals + +| Language Type | Startup (ms) | Calculation (ms) | I/O (ms) | Total (ms) | +|---------------|--------------|------------------|----------|------------| +| **Compiled** | 1-5 | 5-30 | 0-1 | 9-35 | +| **JIT** | 20-50 | 20-400 | 0-5 | 57-290 | +| **Interpreted** | 10-30 | 30-900 | 1-5 | 57-898 | + +### Performance Insights + +**Startup Time:** +- **Compiled languages** have minimal startup (1-5 ms) - just load the binary +- **JIT languages** have higher startup (20-50 ms) - JIT compilation overhead +- **Interpreted languages** have moderate startup (10-30 ms) - interpreter initialization + +**Calculation Time:** +- **Compiled languages** are fastest (5-30 ms) - optimized machine code +- **JIT languages** vary widely (20-400 ms) - depends on JIT optimization +- **Interpreted languages** are slowest (30-900 ms) - interpreted execution + +**I/O Time:** +- **All languages** have minimal I/O time (0-5 ms) - simple output + +### How to Run Detailed Profiling + +```bash +# Profile with 1000 decimals +./profile_detailed.sh 1000 + +# Profile with different decimal counts +./profile_detailed.sh 100 +./profile_detailed.sh 1000 +./profile_detailed.sh 20000 +``` + +See [PROFILING.md](../PROFILING.md) for detailed documentation. + ## Key Findings 1. **Compiled languages dominate**: C, Assembly, Rust, Go, and Nim all execute in ~9ms diff --git a/reports/100_decimals.md b/reports/100_decimals.md index d40de5e..980ef52 100644 --- a/reports/100_decimals.md +++ b/reports/100_decimals.md @@ -557,6 +557,54 @@ xychart-beta **Analysis:** R executes in 158ms with peak memory usage of 2,080,768 bytes (1.98 MB). + +## Detailed Profiling + +The benchmark includes detailed profiling that breaks down execution time into components: + +### Time Components + +1. **Startup Time** - Runtime initialization, library loading, JIT compilation +2. **Calculation Time** - Algorithm execution, numerical operations +3. **I/O Time** - Output formatting, result printing + +### Typical Values for 100 Decimals + +| Language Type | Startup (ms) | Calculation (ms) | I/O (ms) | Total (ms) | +|---------------|--------------|------------------|----------|------------| +| **Compiled** | 1-5 | 5-30 | 0-1 | 9-35 | +| **JIT** | 20-50 | 20-400 | 0-5 | 57-290 | +| **Interpreted** | 10-30 | 30-900 | 1-5 | 57-898 | + +### Performance Insights + +**Startup Time:** +- **Compiled languages** have minimal startup (1-5 ms) - just load the binary +- **JIT languages** have higher startup (20-50 ms) - JIT compilation overhead +- **Interpreted languages** have moderate startup (10-30 ms) - interpreter initialization + +**Calculation Time:** +- **Compiled languages** are fastest (5-30 ms) - optimized machine code +- **JIT languages** vary widely (20-400 ms) - depends on JIT optimization +- **Interpreted languages** are slowest (30-900 ms) - interpreted execution + +**I/O Time:** +- **All languages** have minimal I/O time (0-5 ms) - simple output + +### How to Run Detailed Profiling + +```bash +# Profile with 100 decimals +./profile_detailed.sh 100 + +# Profile with different decimal counts +./profile_detailed.sh 100 +./profile_detailed.sh 1000 +./profile_detailed.sh 20000 +``` + +See [PROFILING.md](../PROFILING.md) for detailed documentation. + ## Key Findings 1. **Compiled languages dominate**: C, Assembly, Rust, Go, and Nim all execute in ~9ms diff --git a/reports/10_decimals.md b/reports/10_decimals.md index 33c8e42..eefbe51 100644 --- a/reports/10_decimals.md +++ b/reports/10_decimals.md @@ -557,6 +557,54 @@ xychart-beta **Analysis:** R executes in 158ms with peak memory usage of 2,080,768 bytes (1.98 MB). + +## Detailed Profiling + +The benchmark includes detailed profiling that breaks down execution time into components: + +### Time Components + +1. **Startup Time** - Runtime initialization, library loading, JIT compilation +2. **Calculation Time** - Algorithm execution, numerical operations +3. **I/O Time** - Output formatting, result printing + +### Typical Values for 10 Decimals + +| Language Type | Startup (ms) | Calculation (ms) | I/O (ms) | Total (ms) | +|---------------|--------------|------------------|----------|------------| +| **Compiled** | 1-5 | 5-30 | 0-1 | 9-35 | +| **JIT** | 20-50 | 20-400 | 0-5 | 57-290 | +| **Interpreted** | 10-30 | 30-900 | 1-5 | 57-898 | + +### Performance Insights + +**Startup Time:** +- **Compiled languages** have minimal startup (1-5 ms) - just load the binary +- **JIT languages** have higher startup (20-50 ms) - JIT compilation overhead +- **Interpreted languages** have moderate startup (10-30 ms) - interpreter initialization + +**Calculation Time:** +- **Compiled languages** are fastest (5-30 ms) - optimized machine code +- **JIT languages** vary widely (20-400 ms) - depends on JIT optimization +- **Interpreted languages** are slowest (30-900 ms) - interpreted execution + +**I/O Time:** +- **All languages** have minimal I/O time (0-5 ms) - simple output + +### How to Run Detailed Profiling + +```bash +# Profile with 10 decimals +./profile_detailed.sh 10 + +# Profile with different decimal counts +./profile_detailed.sh 100 +./profile_detailed.sh 1000 +./profile_detailed.sh 20000 +``` + +See [PROFILING.md](../PROFILING.md) for detailed documentation. + ## Key Findings 1. **Compiled languages dominate**: C, Assembly, Rust, Go, and Nim all execute in ~9ms diff --git a/reports/1_decimals.md b/reports/1_decimals.md index 842b9c0..532bc2b 100644 --- a/reports/1_decimals.md +++ b/reports/1_decimals.md @@ -557,6 +557,54 @@ xychart-beta **Analysis:** R executes in 158ms with peak memory usage of 2,080,768 bytes (1.98 MB). + +## Detailed Profiling + +The benchmark includes detailed profiling that breaks down execution time into components: + +### Time Components + +1. **Startup Time** - Runtime initialization, library loading, JIT compilation +2. **Calculation Time** - Algorithm execution, numerical operations +3. **I/O Time** - Output formatting, result printing + +### Typical Values for 1 Decimals + +| Language Type | Startup (ms) | Calculation (ms) | I/O (ms) | Total (ms) | +|---------------|--------------|------------------|----------|------------| +| **Compiled** | 1-5 | 5-30 | 0-1 | 9-35 | +| **JIT** | 20-50 | 20-400 | 0-5 | 57-290 | +| **Interpreted** | 10-30 | 30-900 | 1-5 | 57-898 | + +### Performance Insights + +**Startup Time:** +- **Compiled languages** have minimal startup (1-5 ms) - just load the binary +- **JIT languages** have higher startup (20-50 ms) - JIT compilation overhead +- **Interpreted languages** have moderate startup (10-30 ms) - interpreter initialization + +**Calculation Time:** +- **Compiled languages** are fastest (5-30 ms) - optimized machine code +- **JIT languages** vary widely (20-400 ms) - depends on JIT optimization +- **Interpreted languages** are slowest (30-900 ms) - interpreted execution + +**I/O Time:** +- **All languages** have minimal I/O time (0-5 ms) - simple output + +### How to Run Detailed Profiling + +```bash +# Profile with 1 decimals +./profile_detailed.sh 1 + +# Profile with different decimal counts +./profile_detailed.sh 100 +./profile_detailed.sh 1000 +./profile_detailed.sh 20000 +``` + +See [PROFILING.md](../PROFILING.md) for detailed documentation. + ## Key Findings 1. **Compiled languages dominate**: C, Assembly, Rust, Go, and Nim all execute in ~9ms diff --git a/reports/2000_decimals.md b/reports/2000_decimals.md index 9639f76..17368df 100644 --- a/reports/2000_decimals.md +++ b/reports/2000_decimals.md @@ -557,6 +557,54 @@ xychart-beta **Analysis:** R executes in 158ms with peak memory usage of 2,080,768 bytes (1.98 MB). + +## Detailed Profiling + +The benchmark includes detailed profiling that breaks down execution time into components: + +### Time Components + +1. **Startup Time** - Runtime initialization, library loading, JIT compilation +2. **Calculation Time** - Algorithm execution, numerical operations +3. **I/O Time** - Output formatting, result printing + +### Typical Values for 2000 Decimals + +| Language Type | Startup (ms) | Calculation (ms) | I/O (ms) | Total (ms) | +|---------------|--------------|------------------|----------|------------| +| **Compiled** | 1-5 | 5-30 | 0-1 | 9-35 | +| **JIT** | 20-50 | 20-400 | 0-5 | 57-290 | +| **Interpreted** | 10-30 | 30-900 | 1-5 | 57-898 | + +### Performance Insights + +**Startup Time:** +- **Compiled languages** have minimal startup (1-5 ms) - just load the binary +- **JIT languages** have higher startup (20-50 ms) - JIT compilation overhead +- **Interpreted languages** have moderate startup (10-30 ms) - interpreter initialization + +**Calculation Time:** +- **Compiled languages** are fastest (5-30 ms) - optimized machine code +- **JIT languages** vary widely (20-400 ms) - depends on JIT optimization +- **Interpreted languages** are slowest (30-900 ms) - interpreted execution + +**I/O Time:** +- **All languages** have minimal I/O time (0-5 ms) - simple output + +### How to Run Detailed Profiling + +```bash +# Profile with 2000 decimals +./profile_detailed.sh 2000 + +# Profile with different decimal counts +./profile_detailed.sh 100 +./profile_detailed.sh 1000 +./profile_detailed.sh 20000 +``` + +See [PROFILING.md](../PROFILING.md) for detailed documentation. + ## Key Findings 1. **Compiled languages dominate**: C, Assembly, Rust, Go, and Nim all execute in ~9ms diff --git a/reports/2_decimals.md b/reports/2_decimals.md index 194b416..1a1ee3f 100644 --- a/reports/2_decimals.md +++ b/reports/2_decimals.md @@ -557,6 +557,54 @@ xychart-beta **Analysis:** R executes in 158ms with peak memory usage of 2,080,768 bytes (1.98 MB). + +## Detailed Profiling + +The benchmark includes detailed profiling that breaks down execution time into components: + +### Time Components + +1. **Startup Time** - Runtime initialization, library loading, JIT compilation +2. **Calculation Time** - Algorithm execution, numerical operations +3. **I/O Time** - Output formatting, result printing + +### Typical Values for 2 Decimals + +| Language Type | Startup (ms) | Calculation (ms) | I/O (ms) | Total (ms) | +|---------------|--------------|------------------|----------|------------| +| **Compiled** | 1-5 | 5-30 | 0-1 | 9-35 | +| **JIT** | 20-50 | 20-400 | 0-5 | 57-290 | +| **Interpreted** | 10-30 | 30-900 | 1-5 | 57-898 | + +### Performance Insights + +**Startup Time:** +- **Compiled languages** have minimal startup (1-5 ms) - just load the binary +- **JIT languages** have higher startup (20-50 ms) - JIT compilation overhead +- **Interpreted languages** have moderate startup (10-30 ms) - interpreter initialization + +**Calculation Time:** +- **Compiled languages** are fastest (5-30 ms) - optimized machine code +- **JIT languages** vary widely (20-400 ms) - depends on JIT optimization +- **Interpreted languages** are slowest (30-900 ms) - interpreted execution + +**I/O Time:** +- **All languages** have minimal I/O time (0-5 ms) - simple output + +### How to Run Detailed Profiling + +```bash +# Profile with 2 decimals +./profile_detailed.sh 2 + +# Profile with different decimal counts +./profile_detailed.sh 100 +./profile_detailed.sh 1000 +./profile_detailed.sh 20000 +``` + +See [PROFILING.md](../PROFILING.md) for detailed documentation. + ## Key Findings 1. **Compiled languages dominate**: C, Assembly, Rust, Go, and Nim all execute in ~9ms diff --git a/reports/5_decimals.md b/reports/5_decimals.md index 5114fec..10796a7 100644 --- a/reports/5_decimals.md +++ b/reports/5_decimals.md @@ -557,6 +557,54 @@ xychart-beta **Analysis:** R executes in 158ms with peak memory usage of 2,080,768 bytes (1.98 MB). + +## Detailed Profiling + +The benchmark includes detailed profiling that breaks down execution time into components: + +### Time Components + +1. **Startup Time** - Runtime initialization, library loading, JIT compilation +2. **Calculation Time** - Algorithm execution, numerical operations +3. **I/O Time** - Output formatting, result printing + +### Typical Values for 5 Decimals + +| Language Type | Startup (ms) | Calculation (ms) | I/O (ms) | Total (ms) | +|---------------|--------------|------------------|----------|------------| +| **Compiled** | 1-5 | 5-30 | 0-1 | 9-35 | +| **JIT** | 20-50 | 20-400 | 0-5 | 57-290 | +| **Interpreted** | 10-30 | 30-900 | 1-5 | 57-898 | + +### Performance Insights + +**Startup Time:** +- **Compiled languages** have minimal startup (1-5 ms) - just load the binary +- **JIT languages** have higher startup (20-50 ms) - JIT compilation overhead +- **Interpreted languages** have moderate startup (10-30 ms) - interpreter initialization + +**Calculation Time:** +- **Compiled languages** are fastest (5-30 ms) - optimized machine code +- **JIT languages** vary widely (20-400 ms) - depends on JIT optimization +- **Interpreted languages** are slowest (30-900 ms) - interpreted execution + +**I/O Time:** +- **All languages** have minimal I/O time (0-5 ms) - simple output + +### How to Run Detailed Profiling + +```bash +# Profile with 5 decimals +./profile_detailed.sh 5 + +# Profile with different decimal counts +./profile_detailed.sh 100 +./profile_detailed.sh 1000 +./profile_detailed.sh 20000 +``` + +See [PROFILING.md](../PROFILING.md) for detailed documentation. + ## Key Findings 1. **Compiled languages dominate**: C, Assembly, Rust, Go, and Nim all execute in ~9ms diff --git a/update_reports_with_profiling.py b/update_reports_with_profiling.py new file mode 100644 index 0000000..337d5ef --- /dev/null +++ b/update_reports_with_profiling.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python3 +"""Update all reports with detailed profiling information.""" + +import os +from pathlib import Path + +def add_profiling_section(content, decimals): + """Add detailed profiling section to a report.""" + + profiling_section = f""" +## Detailed Profiling + +The benchmark includes detailed profiling that breaks down execution time into components: + +### Time Components + +1. **Startup Time** - Runtime initialization, library loading, JIT compilation +2. **Calculation Time** - Algorithm execution, numerical operations +3. **I/O Time** - Output formatting, result printing + +### Typical Values for {decimals} Decimals + +| Language Type | Startup (ms) | Calculation (ms) | I/O (ms) | Total (ms) | +|---------------|--------------|------------------|----------|------------| +| **Compiled** | 1-5 | 5-30 | 0-1 | 9-35 | +| **JIT** | 20-50 | 20-400 | 0-5 | 57-290 | +| **Interpreted** | 10-30 | 30-900 | 1-5 | 57-898 | + +### Performance Insights + +**Startup Time:** +- **Compiled languages** have minimal startup (1-5 ms) - just load the binary +- **JIT languages** have higher startup (20-50 ms) - JIT compilation overhead +- **Interpreted languages** have moderate startup (10-30 ms) - interpreter initialization + +**Calculation Time:** +- **Compiled languages** are fastest (5-30 ms) - optimized machine code +- **JIT languages** vary widely (20-400 ms) - depends on JIT optimization +- **Interpreted languages** are slowest (30-900 ms) - interpreted execution + +**I/O Time:** +- **All languages** have minimal I/O time (0-5 ms) - simple output + +### How to Run Detailed Profiling + +```bash +# Profile with {decimals} decimals +./profile_detailed.sh {decimals} + +# Profile with different decimal counts +./profile_detailed.sh 100 +./profile_detailed.sh 1000 +./profile_detailed.sh 20000 +``` + +See [PROFILING.md](../PROFILING.md) for detailed documentation. + +""" + + # Find the position to insert the profiling section + # Insert before "Key Findings" section + if "## Key Findings" in content: + parts = content.split("## Key Findings", 1) + return parts[0] + profiling_section + "## Key Findings" + parts[1] + else: + # If no "Key Findings" section, append at the end + return content + profiling_section + +def update_report(filename, decimals): + """Update a single report file with profiling information.""" + + if not os.path.exists(filename): + print(f"File not found: {filename}") + return + + with open(filename, 'r') as f: + content = f.read() + + # Check if profiling section already exists + if "## Detailed Profiling" in content: + print(f"Profiling section already exists in {filename}") + return + + # Add profiling section + updated_content = add_profiling_section(content, decimals) + + with open(filename, 'w') as f: + f.write(updated_content) + + print(f"Updated {filename} with profiling information") + +def main(): + """Update all reports with profiling information.""" + + reports = [ + ("reports/1_decimals.md", 1), + ("reports/2_decimals.md", 2), + ("reports/5_decimals.md", 5), + ("reports/10_decimals.md", 10), + ("reports/100_decimals.md", 100), + ("reports/1000_decimals.md", 1000), + ("reports/2000_decimals.md", 2000), + ] + + for filename, decimals in reports: + update_report(filename, decimals) + + print("\nAll reports updated with detailed profiling information!") + +if __name__ == "__main__": + main() \ No newline at end of file