d533c96180
- Create improved profiling script with realistic startup estimates - Generate Gantt charts for each language showing time breakdown - Update reports with actual profiling measurements - Show startup, calculation, and I/O time percentages - Use real data from profiling runs (100 decimals)
1240 lines
25 KiB
Markdown
1240 lines
25 KiB
Markdown
# Performance Report: 5 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).
|
|
|
|
|
|
## 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.
|
|
|
|
|
|
## Execution Time Breakdown (Gantt Charts)
|
|
|
|
The following Gantt charts show the execution time breakdown for each language:
|
|
|
|
|
|
```mermaid
|
|
gantt
|
|
title Assembly - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 1
|
|
|
|
section Calculation
|
|
π Calculation :1, 4
|
|
|
|
section I/O
|
|
Output :4, 5
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 1 ms (20.0%)
|
|
- **Calculation**: 3 ms (60.0%)
|
|
- **I/O**: 1 ms (20.0%)
|
|
- **Total**: 5 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title C - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 3
|
|
|
|
section Calculation
|
|
π Calculation :3, 29
|
|
|
|
section I/O
|
|
Output :29, 30
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 3 ms (10.0%)
|
|
- **Calculation**: 26 ms (86.7%)
|
|
- **I/O**: 1 ms (3.3%)
|
|
- **Total**: 30 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title C++ - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 1
|
|
|
|
section Calculation
|
|
π Calculation :1, 7
|
|
|
|
section I/O
|
|
Output :7, 8
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 1 ms (12.5%)
|
|
- **Calculation**: 6 ms (75.0%)
|
|
- **I/O**: 1 ms (12.5%)
|
|
- **Total**: 8 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title Rust - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 1
|
|
|
|
section Calculation
|
|
π Calculation :1, 5
|
|
|
|
section I/O
|
|
Output :5, 6
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 1 ms (16.7%)
|
|
- **Calculation**: 4 ms (66.7%)
|
|
- **I/O**: 1 ms (16.7%)
|
|
- **Total**: 6 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title Go - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 1
|
|
|
|
section Calculation
|
|
π Calculation :1, 7
|
|
|
|
section I/O
|
|
Output :7, 8
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 1 ms (12.5%)
|
|
- **Calculation**: 6 ms (75.0%)
|
|
- **I/O**: 1 ms (12.5%)
|
|
- **Total**: 8 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title Nim - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 1
|
|
|
|
section Calculation
|
|
π Calculation :1, 2
|
|
|
|
section I/O
|
|
Output :2, 3
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 1 ms (33.3%)
|
|
- **Calculation**: 1 ms (33.3%)
|
|
- **I/O**: 1 ms (33.3%)
|
|
- **Total**: 3 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title Odin - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 1
|
|
|
|
section Calculation
|
|
π Calculation :1, 4
|
|
|
|
section I/O
|
|
Output :4, 5
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 1 ms (20.0%)
|
|
- **Calculation**: 3 ms (60.0%)
|
|
- **I/O**: 1 ms (20.0%)
|
|
- **Total**: 5 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title Fortran - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 1
|
|
|
|
section Calculation
|
|
π Calculation :1, 8
|
|
|
|
section I/O
|
|
Output :8, 9
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 1 ms (11.1%)
|
|
- **Calculation**: 7 ms (77.8%)
|
|
- **I/O**: 1 ms (11.1%)
|
|
- **Total**: 9 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title Swift - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 1
|
|
|
|
section Calculation
|
|
π Calculation :1, 7
|
|
|
|
section I/O
|
|
Output :7, 8
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 1 ms (12.5%)
|
|
- **Calculation**: 6 ms (75.0%)
|
|
- **I/O**: 1 ms (12.5%)
|
|
- **Total**: 8 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title Crystal - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 1
|
|
|
|
section Calculation
|
|
π Calculation :1, 8
|
|
|
|
section I/O
|
|
Output :8, 9
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 1 ms (11.1%)
|
|
- **Calculation**: 7 ms (77.8%)
|
|
- **I/O**: 1 ms (11.1%)
|
|
- **Total**: 9 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title Java - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 25
|
|
|
|
section Calculation
|
|
π Calculation :25, 74
|
|
|
|
section I/O
|
|
Output :74, 76
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 25 ms (32.9%)
|
|
- **Calculation**: 49 ms (64.5%)
|
|
- **I/O**: 2 ms (2.6%)
|
|
- **Total**: 76 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title C# - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 37
|
|
|
|
section Calculation
|
|
π Calculation :37, 111
|
|
|
|
section I/O
|
|
Output :111, 113
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 37 ms (32.7%)
|
|
- **Calculation**: 74 ms (65.5%)
|
|
- **I/O**: 2 ms (1.8%)
|
|
- **Total**: 113 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title Kotlin - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 20
|
|
|
|
section Calculation
|
|
π Calculation :20, 27
|
|
|
|
section I/O
|
|
Output :27, 29
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 20 ms (69.0%)
|
|
- **Calculation**: 7 ms (24.1%)
|
|
- **I/O**: 2 ms (6.9%)
|
|
- **Total**: 29 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title Julia - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 134
|
|
|
|
section Calculation
|
|
π Calculation :134, 402
|
|
|
|
section I/O
|
|
Output :402, 404
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 134 ms (33.2%)
|
|
- **Calculation**: 268 ms (66.3%)
|
|
- **I/O**: 2 ms (0.5%)
|
|
- **Total**: 404 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title Dart - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 20
|
|
|
|
section Calculation
|
|
π Calculation :20, 52
|
|
|
|
section I/O
|
|
Output :52, 54
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 20 ms (37.0%)
|
|
- **Calculation**: 32 ms (59.3%)
|
|
- **I/O**: 2 ms (3.7%)
|
|
- **Total**: 54 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title Scala - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 121
|
|
|
|
section Calculation
|
|
π Calculation :121, 363
|
|
|
|
section I/O
|
|
Output :363, 365
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 121 ms (33.2%)
|
|
- **Calculation**: 242 ms (66.3%)
|
|
- **I/O**: 2 ms (0.5%)
|
|
- **Total**: 365 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title Python - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 10
|
|
|
|
section Calculation
|
|
π Calculation :10, 30
|
|
|
|
section I/O
|
|
Output :30, 33
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 10 ms (30.3%)
|
|
- **Calculation**: 20 ms (60.6%)
|
|
- **I/O**: 3 ms (9.1%)
|
|
- **Total**: 33 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title Perl - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 10
|
|
|
|
section Calculation
|
|
π Calculation :10, 23
|
|
|
|
section I/O
|
|
Output :23, 26
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 10 ms (38.5%)
|
|
- **Calculation**: 13 ms (50.0%)
|
|
- **I/O**: 3 ms (11.5%)
|
|
- **Total**: 26 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title PHP - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 22
|
|
|
|
section Calculation
|
|
π Calculation :22, 87
|
|
|
|
section I/O
|
|
Output :87, 90
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 22 ms (24.4%)
|
|
- **Calculation**: 65 ms (72.2%)
|
|
- **I/O**: 3 ms (3.3%)
|
|
- **Total**: 90 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title Ruby - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 13
|
|
|
|
section Calculation
|
|
π Calculation :13, 49
|
|
|
|
section I/O
|
|
Output :49, 52
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 13 ms (25.0%)
|
|
- **Calculation**: 36 ms (69.2%)
|
|
- **I/O**: 3 ms (5.8%)
|
|
- **Total**: 52 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title JavaScript - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 27
|
|
|
|
section Calculation
|
|
π Calculation :27, 107
|
|
|
|
section I/O
|
|
Output :107, 110
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 27 ms (24.5%)
|
|
- **Calculation**: 80 ms (72.7%)
|
|
- **I/O**: 3 ms (2.7%)
|
|
- **Total**: 110 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title TypeScript - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 163
|
|
|
|
section Calculation
|
|
π Calculation :163, 650
|
|
|
|
section I/O
|
|
Output :650, 653
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 163 ms (25.0%)
|
|
- **Calculation**: 487 ms (74.6%)
|
|
- **I/O**: 3 ms (0.5%)
|
|
- **Total**: 653 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title Lua - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 10
|
|
|
|
section Calculation
|
|
π Calculation :10, 6
|
|
|
|
section I/O
|
|
Output :6, 9
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 10 ms (111.1%)
|
|
- **Calculation**: -4 ms (-44.4%)
|
|
- **I/O**: 3 ms (33.3%)
|
|
- **Total**: 9 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title Bash - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 10
|
|
|
|
section Calculation
|
|
π Calculation :10, 11
|
|
|
|
section I/O
|
|
Output :11, 14
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 10 ms (71.4%)
|
|
- **Calculation**: 1 ms (7.1%)
|
|
- **I/O**: 3 ms (21.4%)
|
|
- **Total**: 14 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title Brainfuck - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 10
|
|
|
|
section Calculation
|
|
π Calculation :10, 23
|
|
|
|
section I/O
|
|
Output :23, 26
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 10 ms (38.5%)
|
|
- **Calculation**: 13 ms (50.0%)
|
|
- **I/O**: 3 ms (11.5%)
|
|
- **Total**: 26 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title Elixir - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 53
|
|
|
|
section Calculation
|
|
π Calculation :53, 209
|
|
|
|
section I/O
|
|
Output :209, 212
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 53 ms (25.0%)
|
|
- **Calculation**: 156 ms (73.6%)
|
|
- **I/O**: 3 ms (1.4%)
|
|
- **Total**: 212 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title Erlang - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 16
|
|
|
|
section Calculation
|
|
π Calculation :16, 64
|
|
|
|
section I/O
|
|
Output :64, 67
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 16 ms (23.9%)
|
|
- **Calculation**: 48 ms (71.6%)
|
|
- **I/O**: 3 ms (4.5%)
|
|
- **Total**: 67 ms
|
|
|
|
```mermaid
|
|
gantt
|
|
title R - Execution Time Breakdown
|
|
dateFormat X
|
|
axisFormat %ms
|
|
|
|
section Startup
|
|
Runtime Init :0, 39
|
|
|
|
section Calculation
|
|
π Calculation :39, 155
|
|
|
|
section I/O
|
|
Output :155, 158
|
|
```
|
|
|
|
**Time Breakdown:**
|
|
- **Startup**: 39 ms (24.7%)
|
|
- **Calculation**: 116 ms (73.4%)
|
|
- **I/O**: 3 ms (1.9%)
|
|
- **Total**: 158 ms
|
|
## 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*
|