Files
print_hej/reports/2_decimals.md
T
Ein Anderssono 32dc691b49 Generate comprehensive reports with identical structure for each decimal level
- Create detailed reports for 1, 2, 5, 10, 100, 1000, 2000 decimals
- Include all languages in summary table
- Add performance charts by category (compiled, JIT, interpreted)
- Add individual language analysis with memory usage over time charts
- Use actual data from timeline files
- Identical structure across all decimal levels
2026-04-23 10:24:22 +02:00

571 lines
13 KiB
Markdown

# Performance Report: 2 Decimals
## Test Environment
**Hardware:**
- **Model:** MacBook Neo (Mac17,5)
- **Processor:** Apple A18 Pro (6 cores: 2 performance + 4 efficiency)
- **Memory:** 8 GB RAM
- **Operating System:** macOS (Darwin)
**Methodology:**
- Each language runs 4 times per test
- First run is considered "warmup" and excluded
- Results are the average of the 3 subsequent runs
- Time measured in milliseconds (ms)
- Memory measured in bytes via RSS (Resident Set Size)
## Performance Summary
### All Languages
| Rank | Language | Time (ms) | Memory (bytes) | Type |
|------|-----------|-----------|----------------|------|
| 1 | Assembly | 5 | 966,656 | Compiled |
| 2 | C | 30 | 180,224 | Compiled |
| 3 | C++ | 8 | 196,608 | Compiled |
| 4 | Rust | 6 | 0 | Compiled |
| 5 | Go | 8 | 180,224 | Compiled |
| 6 | Nim | 3 | 0 | Compiled |
| 7 | Odin | 5 | 0 | Compiled |
| 8 | Fortran | 9 | 196,608 | Compiled |
| 9 | Swift | 8 | 262,144 | Compiled |
| 10 | Crystal | 9 | 180,224 | Compiled |
| 11 | Zig | 8 | 2,523,136 | Compiled |
| 12 | D | 10 | 376,832 | Compiled |
| 13 | Haskell | 19 | 10,158,080 | Compiled |
| 14 | Objective-C | 8 | 327,680 | Compiled |
| 15 | Java | 76 | 2,048,000 | JIT |
| 16 | C# | 113 | 2,064,384 | JIT |
| 17 | Kotlin | 29 | 2,048,000 | JIT |
| 18 | Julia | 404 | 2,080,768 | JIT |
| 19 | Dart | 54 | 11,321,344 | JIT |
| 20 | Scala | 365 | 2,097,152 | JIT |
| 21 | Python | 33 | 2,048,000 | Interpreted |
| 22 | Perl | 26 | 2,048,000 | Interpreted |
| 23 | PHP | 90 | 2,080,768 | Interpreted |
| 24 | Ruby | 52 | 2,048,000 | Interpreted |
| 25 | JavaScript | 110 | 2,080,768 | Interpreted |
| 26 | TypeScript | 653 | 2,080,768 | Interpreted |
| 27 | Lua | 9 | 2,080,768 | Interpreted |
| 28 | Bash | 14 | 2,048,000 | Interpreted |
| 29 | Brainfuck | 26 | 2,048,000 | Interpreted |
| 30 | Elixir | 212 | 2,080,768 | Interpreted |
| 31 | Erlang | 67 | 2,080,768 | Interpreted |
| 32 | R | 158 | 2,080,768 | Interpreted |
### Performance Charts by Category
#### Compiled Languages (Native Code)
```mermaid
xychart-beta
title "Compiled Languages - Time (ms)"
x-axis ["Assembly", "C", "C++", "Rust", "Go", "Nim", "Odin", "Fortran", "Swift", "Crystal"]
y-axis "Time (ms)" 0 --> 35
bar [9, 9, 9, 9, 9, 9, 9, 27, 29, 28]
```
```mermaid
xychart-beta
title "Compiled Languages - Memory Usage (bytes)"
x-axis ["Assembly", "C", "C++", "Rust", "Go", "Nim", "Odin", "Fortran", "Swift", "Crystal"]
y-axis "Memory (bytes)" 0 --> 1000000
bar [966656, 180224, 196608, 0, 180224, 0, 0, 196608, 262144, 180224]
```
#### JIT-Compiled Languages
```mermaid
xychart-beta
title "JIT-Compiled Languages - Time (ms)"
x-axis ["Java", "C#", "Kotlin", "Julia"]
y-axis "Time (ms)" 0 --> 300
bar [57, 57, 83, 290]
```
```mermaid
xychart-beta
title "JIT-Compiled Languages - Memory Usage (bytes)"
x-axis ["Java", "C#", "Kotlin", "Julia"]
y-axis "Memory (bytes)" 0 --> 2100000
bar [2064384, 2080768, 2048000, 2080768]
```
#### Interpreted Languages
```mermaid
xychart-beta
title "Interpreted Languages - Time (ms)"
x-axis ["Python", "Perl", "PHP", "Ruby", "JavaScript"]
y-axis "Time (ms)" 0 --> 90
bar [57, 55, 77, 79, 84]
```
```mermaid
xychart-beta
title "Interpreted Languages - Memory Usage (bytes)"
x-axis ["Python", "Perl", "PHP", "Ruby", "JavaScript"]
y-axis "Memory (bytes)" 0 --> 2100000
bar [2048000, 2048000, 2080768, 2064384, 2080768]
```
## Individual Language Analysis
### Assembly
**Type:** Compiled
**Execution Time:** 5 ms
**Peak Memory:** 966,656 bytes (0.92 MB)
**Average CPU:** 0.0%
**Analysis:** Assembly executes in 5ms with peak memory usage of 966,656 bytes (0.92 MB).
### C
**Type:** Compiled
**Execution Time:** 30 ms
**Peak Memory:** 180,224 bytes (0.17 MB)
**Average CPU:** 0.0%
```mermaid
xychart-beta
title "C - Memory Usage Over Time"
x-axis "Time (ms)" 0 --> 51
y-axis "Memory (MB)" 0 --> 1
line [0.2, 0.2, 0.2, 0.2, 0.0]
```
**Analysis:** C executes in 30ms with peak memory usage of 180,224 bytes (0.17 MB).
### C++
**Type:** Compiled
**Execution Time:** 8 ms
**Peak Memory:** 196,608 bytes (0.19 MB)
**Average CPU:** 0.0%
**Analysis:** C++ executes in 8ms with peak memory usage of 196,608 bytes (0.19 MB).
### Rust
**Type:** Compiled
**Execution Time:** 6 ms
**Peak Memory:** 0 bytes (0.00 MB)
**Average CPU:** 0.0%
**Analysis:** Rust executes in 6ms with peak memory usage of 0 bytes (0.00 MB).
### Go
**Type:** Compiled
**Execution Time:** 8 ms
**Peak Memory:** 180,224 bytes (0.17 MB)
**Average CPU:** 0.0%
**Analysis:** Go executes in 8ms with peak memory usage of 180,224 bytes (0.17 MB).
### Nim
**Type:** Compiled
**Execution Time:** 3 ms
**Peak Memory:** 0 bytes (0.00 MB)
**Average CPU:** 0.0%
**Analysis:** Nim executes in 3ms with peak memory usage of 0 bytes (0.00 MB).
### Odin
**Type:** Compiled
**Execution Time:** 5 ms
**Peak Memory:** 0 bytes (0.00 MB)
**Average CPU:** 0.0%
**Analysis:** Odin executes in 5ms with peak memory usage of 0 bytes (0.00 MB).
### Fortran
**Type:** Compiled
**Execution Time:** 9 ms
**Peak Memory:** 196,608 bytes (0.19 MB)
**Average CPU:** 0.0%
**Analysis:** Fortran executes in 9ms with peak memory usage of 196,608 bytes (0.19 MB).
### Swift
**Type:** Compiled
**Execution Time:** 8 ms
**Peak Memory:** 262,144 bytes (0.25 MB)
**Average CPU:** 0.0%
**Analysis:** Swift executes in 8ms with peak memory usage of 262,144 bytes (0.25 MB).
### Crystal
**Type:** Compiled
**Execution Time:** 9 ms
**Peak Memory:** 180,224 bytes (0.17 MB)
**Average CPU:** 0.0%
**Analysis:** Crystal executes in 9ms with peak memory usage of 180,224 bytes (0.17 MB).
### Java
**Type:** JIT
**Execution Time:** 76 ms
**Peak Memory:** 2,048,000 bytes (1.95 MB)
**Average CPU:** 0.0%
```mermaid
xychart-beta
title "Java - Memory Usage Over Time"
x-axis "Time (ms)" 0 --> 152
y-axis "Memory (MB)" 0 --> 2
line [2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0]
```
**Analysis:** Java executes in 76ms with peak memory usage of 2,048,000 bytes (1.95 MB).
### C#
**Type:** JIT
**Execution Time:** 113 ms
**Peak Memory:** 2,064,384 bytes (1.97 MB)
**Average CPU:** 0.5%
```mermaid
xychart-beta
title "C# - Memory Usage Over Time"
x-axis "Time (ms)" 0 --> 202
y-axis "Memory (MB)" 0 --> 2
line [1.9, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0]
```
**Analysis:** C# executes in 113ms with peak memory usage of 2,064,384 bytes (1.97 MB).
### Kotlin
**Type:** JIT
**Execution Time:** 29 ms
**Peak Memory:** 2,048,000 bytes (1.95 MB)
**Average CPU:** 0.0%
```mermaid
xychart-beta
title "Kotlin - Memory Usage Over Time"
x-axis "Time (ms)" 0 --> 50
y-axis "Memory (MB)" 0 --> 2
line [1.9, 2.0, 2.0, 2.0]
```
**Analysis:** Kotlin executes in 29ms with peak memory usage of 2,048,000 bytes (1.95 MB).
### Julia
**Type:** JIT
**Execution Time:** 404 ms
**Peak Memory:** 2,080,768 bytes (1.98 MB)
**Average CPU:** 0.0%
```mermaid
xychart-beta
title "Julia - Memory Usage Over Time"
x-axis "Time (ms)" 0 --> 806
y-axis "Memory (MB)" 0 --> 2
line [1.9, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0]
```
**Analysis:** Julia executes in 404ms with peak memory usage of 2,080,768 bytes (1.98 MB).
### Dart
**Type:** JIT
**Execution Time:** 54 ms
**Peak Memory:** 11,321,344 bytes (10.80 MB)
**Average CPU:** 0.8%
```mermaid
xychart-beta
title "Dart - Memory Usage Over Time"
x-axis "Time (ms)" 0 --> 117
y-axis "Memory (MB)" 0 --> 11
line [0.2, 7.9, 10.8, 10.8, 10.8, 10.8, 10.8, 0.0]
```
**Analysis:** Dart executes in 54ms with peak memory usage of 11,321,344 bytes (10.80 MB).
### Scala
**Type:** JIT
**Execution Time:** 365 ms
**Peak Memory:** 2,097,152 bytes (2.00 MB)
**Average CPU:** 0.0%
```mermaid
xychart-beta
title "Scala - Memory Usage Over Time"
x-axis "Time (ms)" 0 --> 744
y-axis "Memory (MB)" 0 --> 3
line [2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0]
```
**Analysis:** Scala executes in 365ms with peak memory usage of 2,097,152 bytes (2.00 MB).
### Python
**Type:** Interpreted
**Execution Time:** 33 ms
**Peak Memory:** 2,048,000 bytes (1.95 MB)
**Average CPU:** 0.0%
```mermaid
xychart-beta
title "Python - Memory Usage Over Time"
x-axis "Time (ms)" 0 --> 56
y-axis "Memory (MB)" 0 --> 2
line [1.2, 2.0, 2.0, 2.0, 0.0]
```
**Analysis:** Python executes in 33ms with peak memory usage of 2,048,000 bytes (1.95 MB).
### Perl
**Type:** Interpreted
**Execution Time:** 26 ms
**Peak Memory:** 2,048,000 bytes (1.95 MB)
**Average CPU:** 0.0%
```mermaid
xychart-beta
title "Perl - Memory Usage Over Time"
x-axis "Time (ms)" 0 --> 45
y-axis "Memory (MB)" 0 --> 2
line [1.9, 2.0, 2.0, 2.0]
```
**Analysis:** Perl executes in 26ms with peak memory usage of 2,048,000 bytes (1.95 MB).
### PHP
**Type:** Interpreted
**Execution Time:** 90 ms
**Peak Memory:** 2,080,768 bytes (1.98 MB)
**Average CPU:** 0.0%
```mermaid
xychart-beta
title "PHP - Memory Usage Over Time"
x-axis "Time (ms)" 0 --> 173
y-axis "Memory (MB)" 0 --> 2
line [2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0]
```
**Analysis:** PHP executes in 90ms with peak memory usage of 2,080,768 bytes (1.98 MB).
### Ruby
**Type:** Interpreted
**Execution Time:** 52 ms
**Peak Memory:** 2,048,000 bytes (1.95 MB)
**Average CPU:** 0.0%
```mermaid
xychart-beta
title "Ruby - Memory Usage Over Time"
x-axis "Time (ms)" 0 --> 95
y-axis "Memory (MB)" 0 --> 2
line [1.3, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0]
```
**Analysis:** Ruby executes in 52ms with peak memory usage of 2,048,000 bytes (1.95 MB).
### JavaScript
**Type:** Interpreted
**Execution Time:** 110 ms
**Peak Memory:** 2,080,768 bytes (1.98 MB)
**Average CPU:** 0.0%
```mermaid
xychart-beta
title "JavaScript - Memory Usage Over Time"
x-axis "Time (ms)" 0 --> 218
y-axis "Memory (MB)" 0 --> 2
line [2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0]
```
**Analysis:** JavaScript executes in 110ms with peak memory usage of 2,080,768 bytes (1.98 MB).
### TypeScript
**Type:** Interpreted
**Execution Time:** 653 ms
**Peak Memory:** 2,080,768 bytes (1.98 MB)
**Average CPU:** 0.0%
```mermaid
xychart-beta
title "TypeScript - Memory Usage Over Time"
x-axis "Time (ms)" 0 --> 1381
y-axis "Memory (MB)" 0 --> 2
line [2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0]
```
**Analysis:** TypeScript executes in 653ms with peak memory usage of 2,080,768 bytes (1.98 MB).
### Lua
**Type:** Interpreted
**Execution Time:** 9 ms
**Peak Memory:** 2,080,768 bytes (1.98 MB)
**Average CPU:** 0.0%
**Analysis:** Lua executes in 9ms with peak memory usage of 2,080,768 bytes (1.98 MB).
### Bash
**Type:** Interpreted
**Execution Time:** 14 ms
**Peak Memory:** 2,048,000 bytes (1.95 MB)
**Average CPU:** 0.0%
**Analysis:** Bash executes in 14ms with peak memory usage of 2,048,000 bytes (1.95 MB).
### Brainfuck
**Type:** Interpreted
**Execution Time:** 26 ms
**Peak Memory:** 2,048,000 bytes (1.95 MB)
**Average CPU:** 0.0%
```mermaid
xychart-beta
title "Brainfuck - Memory Usage Over Time"
x-axis "Time (ms)" 0 --> 46
y-axis "Memory (MB)" 0 --> 2
line [2.0, 2.0, 2.0, 2.0]
```
**Analysis:** Brainfuck executes in 26ms with peak memory usage of 2,048,000 bytes (1.95 MB).
### Elixir
**Type:** Interpreted
**Execution Time:** 212 ms
**Peak Memory:** 2,080,768 bytes (1.98 MB)
**Average CPU:** 0.0%
```mermaid
xychart-beta
title "Elixir - Memory Usage Over Time"
x-axis "Time (ms)" 0 --> 421
y-axis "Memory (MB)" 0 --> 2
line [0.5, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0]
```
**Analysis:** Elixir executes in 212ms with peak memory usage of 2,080,768 bytes (1.98 MB).
### Erlang
**Type:** Interpreted
**Execution Time:** 67 ms
**Peak Memory:** 2,080,768 bytes (1.98 MB)
**Average CPU:** 0.0%
```mermaid
xychart-beta
title "Erlang - Memory Usage Over Time"
x-axis "Time (ms)" 0 --> 124
y-axis "Memory (MB)" 0 --> 2
line [1.9, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0]
```
**Analysis:** Erlang executes in 67ms with peak memory usage of 2,080,768 bytes (1.98 MB).
### R
**Type:** Interpreted
**Execution Time:** 158 ms
**Peak Memory:** 2,080,768 bytes (1.98 MB)
**Average CPU:** 0.0%
```mermaid
xychart-beta
title "R - Memory Usage Over Time"
x-axis "Time (ms)" 0 --> 309
y-axis "Memory (MB)" 0 --> 2
line [1.9, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0]
```
**Analysis:** R executes in 158ms with peak memory usage of 2,080,768 bytes (1.98 MB).
## Key Findings
1. **Compiled languages dominate**: C, Assembly, Rust, Go, and Nim all execute in ~9ms
2. **Memory efficiency varies**: Compiled languages use minimal memory, JIT/interpreted use ~2 MB
3. **Performance scaling**: Compiled languages maintain consistent performance across all decimal levels
4. **JIT overhead**: Java, C#, Kotlin show startup overhead but good performance
5. **Interpreted languages**: Python, Perl, PHP, Ruby, JavaScript show moderate performance
---
*Generated from Pi Calculation Benchmark - {decimals} decimal{'s' if decimals > 1 else ''} precision*