Add detailed profiling to all reports and README

- Update README.md with profiling information
- Add detailed profiling section to all decimal reports (1, 2, 5, 10, 100, 1000, 2000)
- Include time breakdown: startup, calculation, I/O
- Add typical values table for each language type
- Add performance insights for each component
- Link to PROFILING.md documentation
This commit is contained in:
Ein Anderssono
2026-04-23 10:41:10 +02:00
parent 6fd2d8d883
commit 40745a3835
9 changed files with 460 additions and 0 deletions
+13
View File
@@ -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.
+48
View File
@@ -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
+48
View File
@@ -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
+48
View File
@@ -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
+48
View File
@@ -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
+48
View File
@@ -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
+48
View File
@@ -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
+48
View File
@@ -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
+111
View File
@@ -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()