From 525b8a92f19b63e4260505e51f7e56b2fb4e7d79 Mon Sep 17 00:00:00 2001 From: Ein Anderssono Date: Thu, 23 Apr 2026 14:45:51 +0200 Subject: [PATCH] Replace PNG images with Mermaid.js diagrams - Replaced all PNG visualizations with Mermaid.js diagrams - Mermaid diagrams render directly in GitHub/GitLab - Added 4 chart types per report: - Execution time comparison (bar chart) - Memory usage comparison (bar chart) - CPU efficiency/IPC comparison (bar chart) - Time vs memory trade-off (graph) - All diagrams are interactive and can be viewed in any Markdown viewer - Much better for version control and collaboration --- generate_mermaid_diagrams.py | 133 +++++++++++++++++++++++++++++++ reports/1000_decimals_mermaid.md | 112 ++++++++++++++++++++++++++ reports/100_decimals_mermaid.md | 112 ++++++++++++++++++++++++++ reports/10_decimals_mermaid.md | 112 ++++++++++++++++++++++++++ reports/1_decimals_mermaid.md | 112 ++++++++++++++++++++++++++ reports/2000_decimals_mermaid.md | 112 ++++++++++++++++++++++++++ reports/2_decimals_mermaid.md | 112 ++++++++++++++++++++++++++ reports/5_decimals_mermaid.md | 112 ++++++++++++++++++++++++++ 8 files changed, 917 insertions(+) create mode 100644 generate_mermaid_diagrams.py create mode 100644 reports/1000_decimals_mermaid.md create mode 100644 reports/100_decimals_mermaid.md create mode 100644 reports/10_decimals_mermaid.md create mode 100644 reports/1_decimals_mermaid.md create mode 100644 reports/2000_decimals_mermaid.md create mode 100644 reports/2_decimals_mermaid.md create mode 100644 reports/5_decimals_mermaid.md diff --git a/generate_mermaid_diagrams.py b/generate_mermaid_diagrams.py new file mode 100644 index 0000000..cea543b --- /dev/null +++ b/generate_mermaid_diagrams.py @@ -0,0 +1,133 @@ +#!/usr/bin/env python3 +import os +import csv +import json + +# Read analysis data +with open('data/analysis.json', 'r') as f: + data = json.load(f) + +# Define language types +compiled = ['Assembly', 'C', 'C++', 'Rust', 'Go', 'Nim', 'Odin', 'Fortran', 'Swift', 'Crystal', 'D', 'Zig', 'Objective-C', 'Haskell'] +jit = ['Java', 'CSharp', 'Kotlin', 'Scala', 'Dart', 'Julia'] +interpreted = ['Python', 'JavaScript', 'TypeScript', 'Ruby', 'PHP', 'Perl', 'Lua', 'Bash', 'Brainfuck', 'Elixir', 'Erlang', 'R'] + +def get_type(lang): + if lang in compiled: + return 'Compiled' + elif lang in jit: + return 'JIT' + else: + return 'Interpreted' + +def get_color(lang): + lang_type = get_type(lang) + if lang_type == 'Compiled': + return '#2ecc71' # Green + elif lang_type == 'JIT': + return '#3498db' # Blue + else: + return '#e74c3c' # Red + +# Generate Mermaid diagrams for each decimal level +for decimals in [1, 2, 5, 10, 100, 1000, 2000]: + print(f"Creating Mermaid diagrams for {decimals} decimals...") + + # Sort by time + sorted_by_time = sorted(data.keys(), key=lambda x: data[x].get('time_ms', float('inf'))) + + # Create Mermaid diagram for time comparison (top 20) + mermaid_time = f"""```mermaid +xychart-beta + title "Execution Time Comparison - {decimals} Decimal{'s' if decimals > 1 else ''}" + x-axis [{', '.join([f'"{lang}"' for lang in sorted_by_time[:20]])}] + y-axis "Time (ms)" 0 --> {int(data[sorted_by_time[0]]['time_ms'] * 1.2)} + bar [{', '.join([str(int(data[lang]['time_ms'])) for lang in sorted_by_time[:20]])}] +``` +""" + + # Create Mermaid diagram for memory comparison (top 20) + sorted_by_memory = sorted(data.keys(), key=lambda x: data[x].get('memory_bytes', float('inf'))) + mermaid_memory = f"""```mermaid +xychart-beta + title "Memory Usage Comparison - {decimals} Decimal{'s' if decimals > 1 else ''}" + x-axis [{', '.join([f'"{lang}"' for lang in sorted_by_memory[:20]])}] + y-axis "Memory (MB)" 0 --> {int(data[sorted_by_memory[0]]['memory_bytes'] / (1024 * 1024) * 1.2)} + bar [{', '.join([str(int(data[lang]['memory_bytes'] / (1024 * 1024))) for lang in sorted_by_memory[:20]])}] +``` +""" + + # Create Mermaid diagram for IPC comparison (top 20) + sorted_by_ipc = sorted(data.keys(), key=lambda x: data[x].get('ipc', 0), reverse=True) + mermaid_ipc = f"""```mermaid +xychart-beta + title "CPU Efficiency (IPC) Comparison - {decimals} Decimal{'s' if decimals > 1 else ''}" + x-axis [{', '.join([f'"{lang}"' for lang in sorted_by_ipc[:20]])}] + y-axis "IPC (Instructions Per Cycle)" 0 --> {int(data[sorted_by_ipc[0]]['ipc'] * 1.2)} + bar [{', '.join([str(round(data[lang]['ipc'], 2)) for lang in sorted_by_ipc[:20]])}] +``` +""" + + # Create Mermaid diagram for time vs memory (scatter plot) + # Using a simple bar chart for now since Mermaid doesn't have scatter plots + mermaid_scatter = f"""```mermaid +graph TD + subgraph "Time vs Memory Trade-off - {decimals} Decimal{'s' if decimals > 1 else ''}" +{chr(10).join([f' {lang}["{lang}
Time: {int(data[lang]["time_ms"])}ms
Memory: {int(data[lang]["memory_bytes"] / (1024 * 1024))}MB"]' for lang in sorted_by_time[:10]])} + end +``` +""" + + # Save Mermaid diagrams to file + output_file = f'reports/{decimals}_decimals_mermaid.md' + with open(output_file, 'w') as f: + f.write(f"# Performance Report: {decimals} Decimal{'s' if decimals > 1 else ''}\n\n") + f.write("## Test Environment\n\n") + f.write("**Hardware:**\n") + f.write("- **Model:** MacBook Neo (Mac17,5)\n") + f.write("- **Processor:** Apple A18 Pro (6 cores: 2 performance + 4 efficiency)\n") + f.write("- **Memory:** 8 GB RAM\n") + f.write("- **Operating System:** macOS (Darwin)\n\n") + f.write("**Methodology:**\n") + f.write("- Each language runs 4 times per test\n") + f.write("- First run is considered \"warmup\" and excluded\n") + f.write("- Results are the average of the 3 subsequent runs\n") + f.write("- Time measured in milliseconds (ms)\n") + f.write("- Memory measured in bytes via RSS (Resident Set Size)\n\n") + f.write("## Performance Summary\n\n") + f.write("### All Languages\n\n") + f.write("| Rank | Language | Time (ms) | Memory (bytes) | Instructions | Cycles | IPC | Type |\n") + f.write("|------|-----------|-----------|----------------|--------------|---------|-----|------|\n") + + # Add data + for rank, lang in enumerate(sorted_by_time, 1): + d = data[lang] + time_ms = int(d.get('time_ms', 0)) + memory = int(d.get('memory_bytes', 0)) + instructions = int(d.get('instructions', 0)) + cycles = int(d.get('cycles', 0)) + ipc = d.get('ipc', 0) + lang_type = get_type(lang) + + f.write(f"| {rank} | {lang} | {time_ms} | {memory} | {instructions} | {cycles} | {ipc:.2f} | {lang_type} |\n") + + # Add Mermaid diagrams + f.write("\n## Visualizations\n\n") + f.write("### Execution Time Comparison\n\n") + f.write(mermaid_time) + f.write("\n### Memory Usage Comparison\n\n") + f.write(mermaid_memory) + f.write("\n### CPU Efficiency (IPC) Comparison\n\n") + f.write(mermaid_ipc) + f.write("\n### Time vs Memory Trade-off\n\n") + f.write(mermaid_scatter) + + # Footer + f.write(f"\n## Detailed Results\n\n") + f.write(f"See the full test output in `reports/run_{decimals}_output.txt`.\n\n") + f.write("---\n") + f.write("*Generated from Pi Calculation Benchmark - Apple A18 Pro Performance Study*\n") + + print(f"✓ Created {output_file}") + +print("\n=== All Mermaid diagrams created ===") \ No newline at end of file diff --git a/reports/1000_decimals_mermaid.md b/reports/1000_decimals_mermaid.md new file mode 100644 index 0000000..7b0c601 --- /dev/null +++ b/reports/1000_decimals_mermaid.md @@ -0,0 +1,112 @@ +# Performance Report: 1000 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) | Instructions | Cycles | IPC | Type | +|------|-----------|-----------|----------------|--------------|---------|-----|------| +| 1 | Crystal | 22 | 3293184 | 29546282 | 9885445 | 2.98 | Compiled | +| 2 | D | 24 | 2479445 | 80920081 | 20218601 | 4.00 | Compiled | +| 3 | Zig | 25 | 2981888 | 63916095 | 24932859 | 2.56 | Compiled | +| 4 | C++ | 26 | 1523712 | 23545731 | 9050444 | 2.60 | Compiled | +| 5 | Fortran | 26 | 1802240 | 27378187 | 8787318 | 3.11 | Compiled | +| 6 | Nim | 27 | 1572864 | 15728237 | 5449577 | 2.88 | Compiled | +| 7 | Rust | 27 | 1687552 | 15233650 | 4898110 | 3.11 | Compiled | +| 8 | C | 27 | 1687552 | 14479010 | 6499773 | 2.22 | Compiled | +| 9 | Objective-C | 27 | 6045696 | 27238699 | 10593613 | 2.57 | Compiled | +| 10 | Lua | 29 | 2091690 | 17419324 | 8017680 | 2.17 | Interpreted | +| 11 | Swift | 30 | 6083925 | 50037590 | 16493503 | 3.03 | Compiled | +| 12 | Odin | 30 | 1731242 | 16241385 | 6689690 | 2.42 | Compiled | +| 13 | Go | 31 | 4041386 | 19473738 | 8671903 | 2.24 | Compiled | +| 14 | Assembly | 32 | 1409024 | 12558975 | 6069377 | 2.06 | Compiled | +| 15 | Bash | 34 | 2058922 | 18550685 | 8090090 | 2.29 | Interpreted | +| 16 | Dart | 35 | 14641834 | 63451402 | 27183385 | 2.33 | JIT | +| 17 | Haskell | 46 | 12053162 | 49928755 | 18118511 | 2.75 | Compiled | +| 18 | Brainfuck | 56 | 9185962 | 17501272 | 8126562 | 2.15 | Interpreted | +| 19 | Perl | 58 | 12506453 | 17355692 | 7662235 | 2.26 | Interpreted | +| 20 | Python | 60 | 9737557 | 17485978 | 7928968 | 2.20 | Interpreted | +| 21 | CSharp | 64 | 41462442 | 17452260 | 8624146 | 2.02 | JIT | +| 22 | Kotlin | 65 | 45208917 | 17527899 | 7459125 | 2.34 | JIT | +| 23 | Java | 68 | 43073536 | 17776760 | 8998434 | 1.97 | JIT | +| 24 | PHP | 95 | 26624000 | 17546554 | 7685481 | 2.28 | Interpreted | +| 25 | Ruby | 96 | 28934144 | 17400986 | 7174843 | 2.42 | Interpreted | +| 26 | JavaScript | 118 | 44417024 | 18142055 | 9003896 | 2.01 | Interpreted | +| 27 | Erlang | 185 | 77048490 | 17696158 | 7782102 | 2.27 | Interpreted | +| 28 | Julia | 190 | 236235434 | 17691121 | 7819185 | 2.26 | JIT | +| 29 | R | 220 | 91253418 | 18177908 | 8751540 | 2.07 | Interpreted | +| 30 | Elixir | 406 | 89161728 | 17505478 | 7380020 | 2.37 | Interpreted | +| 31 | Scala | 471 | 55973205 | 18880700 | 8929948 | 2.11 | JIT | +| 32 | TypeScript | 1361 | 208289792 | 17642488 | 7699920 | 2.29 | Interpreted | + +## Visualizations + +### Execution Time Comparison + +```mermaid +xychart-beta + title "Execution Time Comparison - 1000 Decimals" + x-axis ["Crystal", "D", "Zig", "C++", "Fortran", "Nim", "Rust", "C", "Objective-C", "Lua", "Swift", "Odin", "Go", "Assembly", "Bash", "Dart", "Haskell", "Brainfuck", "Perl", "Python"] + y-axis "Time (ms)" 0 --> 26 + bar [22, 24, 25, 26, 26, 27, 27, 27, 27, 29, 30, 30, 31, 32, 34, 35, 46, 56, 58, 60] +``` + +### Memory Usage Comparison + +```mermaid +xychart-beta + title "Memory Usage Comparison - 1000 Decimals" + x-axis ["Assembly", "C++", "Nim", "Rust", "C", "Odin", "Fortran", "Bash", "Lua", "D", "Zig", "Crystal", "Go", "Objective-C", "Swift", "Brainfuck", "Python", "Haskell", "Perl", "Dart"] + y-axis "Memory (MB)" 0 --> 1 + bar [1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 5, 5, 8, 9, 11, 11, 13] +``` + +### CPU Efficiency (IPC) Comparison + +```mermaid +xychart-beta + title "CPU Efficiency (IPC) Comparison - 1000 Decimals" + x-axis ["D", "Rust", "Fortran", "Swift", "Crystal", "Nim", "Haskell", "C++", "Objective-C", "Zig", "Odin", "Ruby", "Elixir", "Kotlin", "Dart", "TypeScript", "Bash", "PHP", "Erlang", "Perl"] + y-axis "IPC (Instructions Per Cycle)" 0 --> 4 + bar [4.0, 3.11, 3.11, 3.03, 2.98, 2.88, 2.75, 2.6, 2.57, 2.56, 2.42, 2.42, 2.37, 2.34, 2.33, 2.29, 2.29, 2.28, 2.27, 2.26] +``` + +### Time vs Memory Trade-off + +```mermaid +graph TD + subgraph "Time vs Memory Trade-off - 1000 Decimals" + Crystal["Crystal
Time: 22ms
Memory: 3MB"] + D["D
Time: 24ms
Memory: 2MB"] + Zig["Zig
Time: 25ms
Memory: 2MB"] + C++["C++
Time: 26ms
Memory: 1MB"] + Fortran["Fortran
Time: 26ms
Memory: 1MB"] + Nim["Nim
Time: 27ms
Memory: 1MB"] + Rust["Rust
Time: 27ms
Memory: 1MB"] + C["C
Time: 27ms
Memory: 1MB"] + Objective-C["Objective-C
Time: 27ms
Memory: 5MB"] + Lua["Lua
Time: 29ms
Memory: 1MB"] + end +``` + +## Detailed Results + +See the full test output in `reports/run_1000_output.txt`. + +--- +*Generated from Pi Calculation Benchmark - Apple A18 Pro Performance Study* diff --git a/reports/100_decimals_mermaid.md b/reports/100_decimals_mermaid.md new file mode 100644 index 0000000..a292dc2 --- /dev/null +++ b/reports/100_decimals_mermaid.md @@ -0,0 +1,112 @@ +# Performance Report: 100 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) | Instructions | Cycles | IPC | Type | +|------|-----------|-----------|----------------|--------------|---------|-----|------| +| 1 | Crystal | 22 | 3293184 | 29546282 | 9885445 | 2.98 | Compiled | +| 2 | D | 24 | 2479445 | 80920081 | 20218601 | 4.00 | Compiled | +| 3 | Zig | 25 | 2981888 | 63916095 | 24932859 | 2.56 | Compiled | +| 4 | C++ | 26 | 1523712 | 23545731 | 9050444 | 2.60 | Compiled | +| 5 | Fortran | 26 | 1802240 | 27378187 | 8787318 | 3.11 | Compiled | +| 6 | Nim | 27 | 1572864 | 15728237 | 5449577 | 2.88 | Compiled | +| 7 | Rust | 27 | 1687552 | 15233650 | 4898110 | 3.11 | Compiled | +| 8 | C | 27 | 1687552 | 14479010 | 6499773 | 2.22 | Compiled | +| 9 | Objective-C | 27 | 6045696 | 27238699 | 10593613 | 2.57 | Compiled | +| 10 | Lua | 29 | 2091690 | 17419324 | 8017680 | 2.17 | Interpreted | +| 11 | Swift | 30 | 6083925 | 50037590 | 16493503 | 3.03 | Compiled | +| 12 | Odin | 30 | 1731242 | 16241385 | 6689690 | 2.42 | Compiled | +| 13 | Go | 31 | 4041386 | 19473738 | 8671903 | 2.24 | Compiled | +| 14 | Assembly | 32 | 1409024 | 12558975 | 6069377 | 2.06 | Compiled | +| 15 | Bash | 34 | 2058922 | 18550685 | 8090090 | 2.29 | Interpreted | +| 16 | Dart | 35 | 14641834 | 63451402 | 27183385 | 2.33 | JIT | +| 17 | Haskell | 46 | 12053162 | 49928755 | 18118511 | 2.75 | Compiled | +| 18 | Brainfuck | 56 | 9185962 | 17501272 | 8126562 | 2.15 | Interpreted | +| 19 | Perl | 58 | 12506453 | 17355692 | 7662235 | 2.26 | Interpreted | +| 20 | Python | 60 | 9737557 | 17485978 | 7928968 | 2.20 | Interpreted | +| 21 | CSharp | 64 | 41462442 | 17452260 | 8624146 | 2.02 | JIT | +| 22 | Kotlin | 65 | 45208917 | 17527899 | 7459125 | 2.34 | JIT | +| 23 | Java | 68 | 43073536 | 17776760 | 8998434 | 1.97 | JIT | +| 24 | PHP | 95 | 26624000 | 17546554 | 7685481 | 2.28 | Interpreted | +| 25 | Ruby | 96 | 28934144 | 17400986 | 7174843 | 2.42 | Interpreted | +| 26 | JavaScript | 118 | 44417024 | 18142055 | 9003896 | 2.01 | Interpreted | +| 27 | Erlang | 185 | 77048490 | 17696158 | 7782102 | 2.27 | Interpreted | +| 28 | Julia | 190 | 236235434 | 17691121 | 7819185 | 2.26 | JIT | +| 29 | R | 220 | 91253418 | 18177908 | 8751540 | 2.07 | Interpreted | +| 30 | Elixir | 406 | 89161728 | 17505478 | 7380020 | 2.37 | Interpreted | +| 31 | Scala | 471 | 55973205 | 18880700 | 8929948 | 2.11 | JIT | +| 32 | TypeScript | 1361 | 208289792 | 17642488 | 7699920 | 2.29 | Interpreted | + +## Visualizations + +### Execution Time Comparison + +```mermaid +xychart-beta + title "Execution Time Comparison - 100 Decimals" + x-axis ["Crystal", "D", "Zig", "C++", "Fortran", "Nim", "Rust", "C", "Objective-C", "Lua", "Swift", "Odin", "Go", "Assembly", "Bash", "Dart", "Haskell", "Brainfuck", "Perl", "Python"] + y-axis "Time (ms)" 0 --> 26 + bar [22, 24, 25, 26, 26, 27, 27, 27, 27, 29, 30, 30, 31, 32, 34, 35, 46, 56, 58, 60] +``` + +### Memory Usage Comparison + +```mermaid +xychart-beta + title "Memory Usage Comparison - 100 Decimals" + x-axis ["Assembly", "C++", "Nim", "Rust", "C", "Odin", "Fortran", "Bash", "Lua", "D", "Zig", "Crystal", "Go", "Objective-C", "Swift", "Brainfuck", "Python", "Haskell", "Perl", "Dart"] + y-axis "Memory (MB)" 0 --> 1 + bar [1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 5, 5, 8, 9, 11, 11, 13] +``` + +### CPU Efficiency (IPC) Comparison + +```mermaid +xychart-beta + title "CPU Efficiency (IPC) Comparison - 100 Decimals" + x-axis ["D", "Rust", "Fortran", "Swift", "Crystal", "Nim", "Haskell", "C++", "Objective-C", "Zig", "Odin", "Ruby", "Elixir", "Kotlin", "Dart", "TypeScript", "Bash", "PHP", "Erlang", "Perl"] + y-axis "IPC (Instructions Per Cycle)" 0 --> 4 + bar [4.0, 3.11, 3.11, 3.03, 2.98, 2.88, 2.75, 2.6, 2.57, 2.56, 2.42, 2.42, 2.37, 2.34, 2.33, 2.29, 2.29, 2.28, 2.27, 2.26] +``` + +### Time vs Memory Trade-off + +```mermaid +graph TD + subgraph "Time vs Memory Trade-off - 100 Decimals" + Crystal["Crystal
Time: 22ms
Memory: 3MB"] + D["D
Time: 24ms
Memory: 2MB"] + Zig["Zig
Time: 25ms
Memory: 2MB"] + C++["C++
Time: 26ms
Memory: 1MB"] + Fortran["Fortran
Time: 26ms
Memory: 1MB"] + Nim["Nim
Time: 27ms
Memory: 1MB"] + Rust["Rust
Time: 27ms
Memory: 1MB"] + C["C
Time: 27ms
Memory: 1MB"] + Objective-C["Objective-C
Time: 27ms
Memory: 5MB"] + Lua["Lua
Time: 29ms
Memory: 1MB"] + end +``` + +## Detailed Results + +See the full test output in `reports/run_100_output.txt`. + +--- +*Generated from Pi Calculation Benchmark - Apple A18 Pro Performance Study* diff --git a/reports/10_decimals_mermaid.md b/reports/10_decimals_mermaid.md new file mode 100644 index 0000000..11513a5 --- /dev/null +++ b/reports/10_decimals_mermaid.md @@ -0,0 +1,112 @@ +# Performance Report: 10 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) | Instructions | Cycles | IPC | Type | +|------|-----------|-----------|----------------|--------------|---------|-----|------| +| 1 | Crystal | 22 | 3293184 | 29546282 | 9885445 | 2.98 | Compiled | +| 2 | D | 24 | 2479445 | 80920081 | 20218601 | 4.00 | Compiled | +| 3 | Zig | 25 | 2981888 | 63916095 | 24932859 | 2.56 | Compiled | +| 4 | C++ | 26 | 1523712 | 23545731 | 9050444 | 2.60 | Compiled | +| 5 | Fortran | 26 | 1802240 | 27378187 | 8787318 | 3.11 | Compiled | +| 6 | Nim | 27 | 1572864 | 15728237 | 5449577 | 2.88 | Compiled | +| 7 | Rust | 27 | 1687552 | 15233650 | 4898110 | 3.11 | Compiled | +| 8 | C | 27 | 1687552 | 14479010 | 6499773 | 2.22 | Compiled | +| 9 | Objective-C | 27 | 6045696 | 27238699 | 10593613 | 2.57 | Compiled | +| 10 | Lua | 29 | 2091690 | 17419324 | 8017680 | 2.17 | Interpreted | +| 11 | Swift | 30 | 6083925 | 50037590 | 16493503 | 3.03 | Compiled | +| 12 | Odin | 30 | 1731242 | 16241385 | 6689690 | 2.42 | Compiled | +| 13 | Go | 31 | 4041386 | 19473738 | 8671903 | 2.24 | Compiled | +| 14 | Assembly | 32 | 1409024 | 12558975 | 6069377 | 2.06 | Compiled | +| 15 | Bash | 34 | 2058922 | 18550685 | 8090090 | 2.29 | Interpreted | +| 16 | Dart | 35 | 14641834 | 63451402 | 27183385 | 2.33 | JIT | +| 17 | Haskell | 46 | 12053162 | 49928755 | 18118511 | 2.75 | Compiled | +| 18 | Brainfuck | 56 | 9185962 | 17501272 | 8126562 | 2.15 | Interpreted | +| 19 | Perl | 58 | 12506453 | 17355692 | 7662235 | 2.26 | Interpreted | +| 20 | Python | 60 | 9737557 | 17485978 | 7928968 | 2.20 | Interpreted | +| 21 | CSharp | 64 | 41462442 | 17452260 | 8624146 | 2.02 | JIT | +| 22 | Kotlin | 65 | 45208917 | 17527899 | 7459125 | 2.34 | JIT | +| 23 | Java | 68 | 43073536 | 17776760 | 8998434 | 1.97 | JIT | +| 24 | PHP | 95 | 26624000 | 17546554 | 7685481 | 2.28 | Interpreted | +| 25 | Ruby | 96 | 28934144 | 17400986 | 7174843 | 2.42 | Interpreted | +| 26 | JavaScript | 118 | 44417024 | 18142055 | 9003896 | 2.01 | Interpreted | +| 27 | Erlang | 185 | 77048490 | 17696158 | 7782102 | 2.27 | Interpreted | +| 28 | Julia | 190 | 236235434 | 17691121 | 7819185 | 2.26 | JIT | +| 29 | R | 220 | 91253418 | 18177908 | 8751540 | 2.07 | Interpreted | +| 30 | Elixir | 406 | 89161728 | 17505478 | 7380020 | 2.37 | Interpreted | +| 31 | Scala | 471 | 55973205 | 18880700 | 8929948 | 2.11 | JIT | +| 32 | TypeScript | 1361 | 208289792 | 17642488 | 7699920 | 2.29 | Interpreted | + +## Visualizations + +### Execution Time Comparison + +```mermaid +xychart-beta + title "Execution Time Comparison - 10 Decimals" + x-axis ["Crystal", "D", "Zig", "C++", "Fortran", "Nim", "Rust", "C", "Objective-C", "Lua", "Swift", "Odin", "Go", "Assembly", "Bash", "Dart", "Haskell", "Brainfuck", "Perl", "Python"] + y-axis "Time (ms)" 0 --> 26 + bar [22, 24, 25, 26, 26, 27, 27, 27, 27, 29, 30, 30, 31, 32, 34, 35, 46, 56, 58, 60] +``` + +### Memory Usage Comparison + +```mermaid +xychart-beta + title "Memory Usage Comparison - 10 Decimals" + x-axis ["Assembly", "C++", "Nim", "Rust", "C", "Odin", "Fortran", "Bash", "Lua", "D", "Zig", "Crystal", "Go", "Objective-C", "Swift", "Brainfuck", "Python", "Haskell", "Perl", "Dart"] + y-axis "Memory (MB)" 0 --> 1 + bar [1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 5, 5, 8, 9, 11, 11, 13] +``` + +### CPU Efficiency (IPC) Comparison + +```mermaid +xychart-beta + title "CPU Efficiency (IPC) Comparison - 10 Decimals" + x-axis ["D", "Rust", "Fortran", "Swift", "Crystal", "Nim", "Haskell", "C++", "Objective-C", "Zig", "Odin", "Ruby", "Elixir", "Kotlin", "Dart", "TypeScript", "Bash", "PHP", "Erlang", "Perl"] + y-axis "IPC (Instructions Per Cycle)" 0 --> 4 + bar [4.0, 3.11, 3.11, 3.03, 2.98, 2.88, 2.75, 2.6, 2.57, 2.56, 2.42, 2.42, 2.37, 2.34, 2.33, 2.29, 2.29, 2.28, 2.27, 2.26] +``` + +### Time vs Memory Trade-off + +```mermaid +graph TD + subgraph "Time vs Memory Trade-off - 10 Decimals" + Crystal["Crystal
Time: 22ms
Memory: 3MB"] + D["D
Time: 24ms
Memory: 2MB"] + Zig["Zig
Time: 25ms
Memory: 2MB"] + C++["C++
Time: 26ms
Memory: 1MB"] + Fortran["Fortran
Time: 26ms
Memory: 1MB"] + Nim["Nim
Time: 27ms
Memory: 1MB"] + Rust["Rust
Time: 27ms
Memory: 1MB"] + C["C
Time: 27ms
Memory: 1MB"] + Objective-C["Objective-C
Time: 27ms
Memory: 5MB"] + Lua["Lua
Time: 29ms
Memory: 1MB"] + end +``` + +## Detailed Results + +See the full test output in `reports/run_10_output.txt`. + +--- +*Generated from Pi Calculation Benchmark - Apple A18 Pro Performance Study* diff --git a/reports/1_decimals_mermaid.md b/reports/1_decimals_mermaid.md new file mode 100644 index 0000000..18f8b6a --- /dev/null +++ b/reports/1_decimals_mermaid.md @@ -0,0 +1,112 @@ +# Performance Report: 1 Decimal + +## 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) | Instructions | Cycles | IPC | Type | +|------|-----------|-----------|----------------|--------------|---------|-----|------| +| 1 | Crystal | 22 | 3293184 | 29546282 | 9885445 | 2.98 | Compiled | +| 2 | D | 24 | 2479445 | 80920081 | 20218601 | 4.00 | Compiled | +| 3 | Zig | 25 | 2981888 | 63916095 | 24932859 | 2.56 | Compiled | +| 4 | C++ | 26 | 1523712 | 23545731 | 9050444 | 2.60 | Compiled | +| 5 | Fortran | 26 | 1802240 | 27378187 | 8787318 | 3.11 | Compiled | +| 6 | Nim | 27 | 1572864 | 15728237 | 5449577 | 2.88 | Compiled | +| 7 | Rust | 27 | 1687552 | 15233650 | 4898110 | 3.11 | Compiled | +| 8 | C | 27 | 1687552 | 14479010 | 6499773 | 2.22 | Compiled | +| 9 | Objective-C | 27 | 6045696 | 27238699 | 10593613 | 2.57 | Compiled | +| 10 | Lua | 29 | 2091690 | 17419324 | 8017680 | 2.17 | Interpreted | +| 11 | Swift | 30 | 6083925 | 50037590 | 16493503 | 3.03 | Compiled | +| 12 | Odin | 30 | 1731242 | 16241385 | 6689690 | 2.42 | Compiled | +| 13 | Go | 31 | 4041386 | 19473738 | 8671903 | 2.24 | Compiled | +| 14 | Assembly | 32 | 1409024 | 12558975 | 6069377 | 2.06 | Compiled | +| 15 | Bash | 34 | 2058922 | 18550685 | 8090090 | 2.29 | Interpreted | +| 16 | Dart | 35 | 14641834 | 63451402 | 27183385 | 2.33 | JIT | +| 17 | Haskell | 46 | 12053162 | 49928755 | 18118511 | 2.75 | Compiled | +| 18 | Brainfuck | 56 | 9185962 | 17501272 | 8126562 | 2.15 | Interpreted | +| 19 | Perl | 58 | 12506453 | 17355692 | 7662235 | 2.26 | Interpreted | +| 20 | Python | 60 | 9737557 | 17485978 | 7928968 | 2.20 | Interpreted | +| 21 | CSharp | 64 | 41462442 | 17452260 | 8624146 | 2.02 | JIT | +| 22 | Kotlin | 65 | 45208917 | 17527899 | 7459125 | 2.34 | JIT | +| 23 | Java | 68 | 43073536 | 17776760 | 8998434 | 1.97 | JIT | +| 24 | PHP | 95 | 26624000 | 17546554 | 7685481 | 2.28 | Interpreted | +| 25 | Ruby | 96 | 28934144 | 17400986 | 7174843 | 2.42 | Interpreted | +| 26 | JavaScript | 118 | 44417024 | 18142055 | 9003896 | 2.01 | Interpreted | +| 27 | Erlang | 185 | 77048490 | 17696158 | 7782102 | 2.27 | Interpreted | +| 28 | Julia | 190 | 236235434 | 17691121 | 7819185 | 2.26 | JIT | +| 29 | R | 220 | 91253418 | 18177908 | 8751540 | 2.07 | Interpreted | +| 30 | Elixir | 406 | 89161728 | 17505478 | 7380020 | 2.37 | Interpreted | +| 31 | Scala | 471 | 55973205 | 18880700 | 8929948 | 2.11 | JIT | +| 32 | TypeScript | 1361 | 208289792 | 17642488 | 7699920 | 2.29 | Interpreted | + +## Visualizations + +### Execution Time Comparison + +```mermaid +xychart-beta + title "Execution Time Comparison - 1 Decimal" + x-axis ["Crystal", "D", "Zig", "C++", "Fortran", "Nim", "Rust", "C", "Objective-C", "Lua", "Swift", "Odin", "Go", "Assembly", "Bash", "Dart", "Haskell", "Brainfuck", "Perl", "Python"] + y-axis "Time (ms)" 0 --> 26 + bar [22, 24, 25, 26, 26, 27, 27, 27, 27, 29, 30, 30, 31, 32, 34, 35, 46, 56, 58, 60] +``` + +### Memory Usage Comparison + +```mermaid +xychart-beta + title "Memory Usage Comparison - 1 Decimal" + x-axis ["Assembly", "C++", "Nim", "Rust", "C", "Odin", "Fortran", "Bash", "Lua", "D", "Zig", "Crystal", "Go", "Objective-C", "Swift", "Brainfuck", "Python", "Haskell", "Perl", "Dart"] + y-axis "Memory (MB)" 0 --> 1 + bar [1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 5, 5, 8, 9, 11, 11, 13] +``` + +### CPU Efficiency (IPC) Comparison + +```mermaid +xychart-beta + title "CPU Efficiency (IPC) Comparison - 1 Decimal" + x-axis ["D", "Rust", "Fortran", "Swift", "Crystal", "Nim", "Haskell", "C++", "Objective-C", "Zig", "Odin", "Ruby", "Elixir", "Kotlin", "Dart", "TypeScript", "Bash", "PHP", "Erlang", "Perl"] + y-axis "IPC (Instructions Per Cycle)" 0 --> 4 + bar [4.0, 3.11, 3.11, 3.03, 2.98, 2.88, 2.75, 2.6, 2.57, 2.56, 2.42, 2.42, 2.37, 2.34, 2.33, 2.29, 2.29, 2.28, 2.27, 2.26] +``` + +### Time vs Memory Trade-off + +```mermaid +graph TD + subgraph "Time vs Memory Trade-off - 1 Decimal" + Crystal["Crystal
Time: 22ms
Memory: 3MB"] + D["D
Time: 24ms
Memory: 2MB"] + Zig["Zig
Time: 25ms
Memory: 2MB"] + C++["C++
Time: 26ms
Memory: 1MB"] + Fortran["Fortran
Time: 26ms
Memory: 1MB"] + Nim["Nim
Time: 27ms
Memory: 1MB"] + Rust["Rust
Time: 27ms
Memory: 1MB"] + C["C
Time: 27ms
Memory: 1MB"] + Objective-C["Objective-C
Time: 27ms
Memory: 5MB"] + Lua["Lua
Time: 29ms
Memory: 1MB"] + end +``` + +## Detailed Results + +See the full test output in `reports/run_1_output.txt`. + +--- +*Generated from Pi Calculation Benchmark - Apple A18 Pro Performance Study* diff --git a/reports/2000_decimals_mermaid.md b/reports/2000_decimals_mermaid.md new file mode 100644 index 0000000..f187d70 --- /dev/null +++ b/reports/2000_decimals_mermaid.md @@ -0,0 +1,112 @@ +# Performance Report: 2000 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) | Instructions | Cycles | IPC | Type | +|------|-----------|-----------|----------------|--------------|---------|-----|------| +| 1 | Crystal | 22 | 3293184 | 29546282 | 9885445 | 2.98 | Compiled | +| 2 | D | 24 | 2479445 | 80920081 | 20218601 | 4.00 | Compiled | +| 3 | Zig | 25 | 2981888 | 63916095 | 24932859 | 2.56 | Compiled | +| 4 | C++ | 26 | 1523712 | 23545731 | 9050444 | 2.60 | Compiled | +| 5 | Fortran | 26 | 1802240 | 27378187 | 8787318 | 3.11 | Compiled | +| 6 | Nim | 27 | 1572864 | 15728237 | 5449577 | 2.88 | Compiled | +| 7 | Rust | 27 | 1687552 | 15233650 | 4898110 | 3.11 | Compiled | +| 8 | C | 27 | 1687552 | 14479010 | 6499773 | 2.22 | Compiled | +| 9 | Objective-C | 27 | 6045696 | 27238699 | 10593613 | 2.57 | Compiled | +| 10 | Lua | 29 | 2091690 | 17419324 | 8017680 | 2.17 | Interpreted | +| 11 | Swift | 30 | 6083925 | 50037590 | 16493503 | 3.03 | Compiled | +| 12 | Odin | 30 | 1731242 | 16241385 | 6689690 | 2.42 | Compiled | +| 13 | Go | 31 | 4041386 | 19473738 | 8671903 | 2.24 | Compiled | +| 14 | Assembly | 32 | 1409024 | 12558975 | 6069377 | 2.06 | Compiled | +| 15 | Bash | 34 | 2058922 | 18550685 | 8090090 | 2.29 | Interpreted | +| 16 | Dart | 35 | 14641834 | 63451402 | 27183385 | 2.33 | JIT | +| 17 | Haskell | 46 | 12053162 | 49928755 | 18118511 | 2.75 | Compiled | +| 18 | Brainfuck | 56 | 9185962 | 17501272 | 8126562 | 2.15 | Interpreted | +| 19 | Perl | 58 | 12506453 | 17355692 | 7662235 | 2.26 | Interpreted | +| 20 | Python | 60 | 9737557 | 17485978 | 7928968 | 2.20 | Interpreted | +| 21 | CSharp | 64 | 41462442 | 17452260 | 8624146 | 2.02 | JIT | +| 22 | Kotlin | 65 | 45208917 | 17527899 | 7459125 | 2.34 | JIT | +| 23 | Java | 68 | 43073536 | 17776760 | 8998434 | 1.97 | JIT | +| 24 | PHP | 95 | 26624000 | 17546554 | 7685481 | 2.28 | Interpreted | +| 25 | Ruby | 96 | 28934144 | 17400986 | 7174843 | 2.42 | Interpreted | +| 26 | JavaScript | 118 | 44417024 | 18142055 | 9003896 | 2.01 | Interpreted | +| 27 | Erlang | 185 | 77048490 | 17696158 | 7782102 | 2.27 | Interpreted | +| 28 | Julia | 190 | 236235434 | 17691121 | 7819185 | 2.26 | JIT | +| 29 | R | 220 | 91253418 | 18177908 | 8751540 | 2.07 | Interpreted | +| 30 | Elixir | 406 | 89161728 | 17505478 | 7380020 | 2.37 | Interpreted | +| 31 | Scala | 471 | 55973205 | 18880700 | 8929948 | 2.11 | JIT | +| 32 | TypeScript | 1361 | 208289792 | 17642488 | 7699920 | 2.29 | Interpreted | + +## Visualizations + +### Execution Time Comparison + +```mermaid +xychart-beta + title "Execution Time Comparison - 2000 Decimals" + x-axis ["Crystal", "D", "Zig", "C++", "Fortran", "Nim", "Rust", "C", "Objective-C", "Lua", "Swift", "Odin", "Go", "Assembly", "Bash", "Dart", "Haskell", "Brainfuck", "Perl", "Python"] + y-axis "Time (ms)" 0 --> 26 + bar [22, 24, 25, 26, 26, 27, 27, 27, 27, 29, 30, 30, 31, 32, 34, 35, 46, 56, 58, 60] +``` + +### Memory Usage Comparison + +```mermaid +xychart-beta + title "Memory Usage Comparison - 2000 Decimals" + x-axis ["Assembly", "C++", "Nim", "Rust", "C", "Odin", "Fortran", "Bash", "Lua", "D", "Zig", "Crystal", "Go", "Objective-C", "Swift", "Brainfuck", "Python", "Haskell", "Perl", "Dart"] + y-axis "Memory (MB)" 0 --> 1 + bar [1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 5, 5, 8, 9, 11, 11, 13] +``` + +### CPU Efficiency (IPC) Comparison + +```mermaid +xychart-beta + title "CPU Efficiency (IPC) Comparison - 2000 Decimals" + x-axis ["D", "Rust", "Fortran", "Swift", "Crystal", "Nim", "Haskell", "C++", "Objective-C", "Zig", "Odin", "Ruby", "Elixir", "Kotlin", "Dart", "TypeScript", "Bash", "PHP", "Erlang", "Perl"] + y-axis "IPC (Instructions Per Cycle)" 0 --> 4 + bar [4.0, 3.11, 3.11, 3.03, 2.98, 2.88, 2.75, 2.6, 2.57, 2.56, 2.42, 2.42, 2.37, 2.34, 2.33, 2.29, 2.29, 2.28, 2.27, 2.26] +``` + +### Time vs Memory Trade-off + +```mermaid +graph TD + subgraph "Time vs Memory Trade-off - 2000 Decimals" + Crystal["Crystal
Time: 22ms
Memory: 3MB"] + D["D
Time: 24ms
Memory: 2MB"] + Zig["Zig
Time: 25ms
Memory: 2MB"] + C++["C++
Time: 26ms
Memory: 1MB"] + Fortran["Fortran
Time: 26ms
Memory: 1MB"] + Nim["Nim
Time: 27ms
Memory: 1MB"] + Rust["Rust
Time: 27ms
Memory: 1MB"] + C["C
Time: 27ms
Memory: 1MB"] + Objective-C["Objective-C
Time: 27ms
Memory: 5MB"] + Lua["Lua
Time: 29ms
Memory: 1MB"] + end +``` + +## Detailed Results + +See the full test output in `reports/run_2000_output.txt`. + +--- +*Generated from Pi Calculation Benchmark - Apple A18 Pro Performance Study* diff --git a/reports/2_decimals_mermaid.md b/reports/2_decimals_mermaid.md new file mode 100644 index 0000000..0f6c8c5 --- /dev/null +++ b/reports/2_decimals_mermaid.md @@ -0,0 +1,112 @@ +# 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) | Instructions | Cycles | IPC | Type | +|------|-----------|-----------|----------------|--------------|---------|-----|------| +| 1 | Crystal | 22 | 3293184 | 29546282 | 9885445 | 2.98 | Compiled | +| 2 | D | 24 | 2479445 | 80920081 | 20218601 | 4.00 | Compiled | +| 3 | Zig | 25 | 2981888 | 63916095 | 24932859 | 2.56 | Compiled | +| 4 | C++ | 26 | 1523712 | 23545731 | 9050444 | 2.60 | Compiled | +| 5 | Fortran | 26 | 1802240 | 27378187 | 8787318 | 3.11 | Compiled | +| 6 | Nim | 27 | 1572864 | 15728237 | 5449577 | 2.88 | Compiled | +| 7 | Rust | 27 | 1687552 | 15233650 | 4898110 | 3.11 | Compiled | +| 8 | C | 27 | 1687552 | 14479010 | 6499773 | 2.22 | Compiled | +| 9 | Objective-C | 27 | 6045696 | 27238699 | 10593613 | 2.57 | Compiled | +| 10 | Lua | 29 | 2091690 | 17419324 | 8017680 | 2.17 | Interpreted | +| 11 | Swift | 30 | 6083925 | 50037590 | 16493503 | 3.03 | Compiled | +| 12 | Odin | 30 | 1731242 | 16241385 | 6689690 | 2.42 | Compiled | +| 13 | Go | 31 | 4041386 | 19473738 | 8671903 | 2.24 | Compiled | +| 14 | Assembly | 32 | 1409024 | 12558975 | 6069377 | 2.06 | Compiled | +| 15 | Bash | 34 | 2058922 | 18550685 | 8090090 | 2.29 | Interpreted | +| 16 | Dart | 35 | 14641834 | 63451402 | 27183385 | 2.33 | JIT | +| 17 | Haskell | 46 | 12053162 | 49928755 | 18118511 | 2.75 | Compiled | +| 18 | Brainfuck | 56 | 9185962 | 17501272 | 8126562 | 2.15 | Interpreted | +| 19 | Perl | 58 | 12506453 | 17355692 | 7662235 | 2.26 | Interpreted | +| 20 | Python | 60 | 9737557 | 17485978 | 7928968 | 2.20 | Interpreted | +| 21 | CSharp | 64 | 41462442 | 17452260 | 8624146 | 2.02 | JIT | +| 22 | Kotlin | 65 | 45208917 | 17527899 | 7459125 | 2.34 | JIT | +| 23 | Java | 68 | 43073536 | 17776760 | 8998434 | 1.97 | JIT | +| 24 | PHP | 95 | 26624000 | 17546554 | 7685481 | 2.28 | Interpreted | +| 25 | Ruby | 96 | 28934144 | 17400986 | 7174843 | 2.42 | Interpreted | +| 26 | JavaScript | 118 | 44417024 | 18142055 | 9003896 | 2.01 | Interpreted | +| 27 | Erlang | 185 | 77048490 | 17696158 | 7782102 | 2.27 | Interpreted | +| 28 | Julia | 190 | 236235434 | 17691121 | 7819185 | 2.26 | JIT | +| 29 | R | 220 | 91253418 | 18177908 | 8751540 | 2.07 | Interpreted | +| 30 | Elixir | 406 | 89161728 | 17505478 | 7380020 | 2.37 | Interpreted | +| 31 | Scala | 471 | 55973205 | 18880700 | 8929948 | 2.11 | JIT | +| 32 | TypeScript | 1361 | 208289792 | 17642488 | 7699920 | 2.29 | Interpreted | + +## Visualizations + +### Execution Time Comparison + +```mermaid +xychart-beta + title "Execution Time Comparison - 2 Decimals" + x-axis ["Crystal", "D", "Zig", "C++", "Fortran", "Nim", "Rust", "C", "Objective-C", "Lua", "Swift", "Odin", "Go", "Assembly", "Bash", "Dart", "Haskell", "Brainfuck", "Perl", "Python"] + y-axis "Time (ms)" 0 --> 26 + bar [22, 24, 25, 26, 26, 27, 27, 27, 27, 29, 30, 30, 31, 32, 34, 35, 46, 56, 58, 60] +``` + +### Memory Usage Comparison + +```mermaid +xychart-beta + title "Memory Usage Comparison - 2 Decimals" + x-axis ["Assembly", "C++", "Nim", "Rust", "C", "Odin", "Fortran", "Bash", "Lua", "D", "Zig", "Crystal", "Go", "Objective-C", "Swift", "Brainfuck", "Python", "Haskell", "Perl", "Dart"] + y-axis "Memory (MB)" 0 --> 1 + bar [1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 5, 5, 8, 9, 11, 11, 13] +``` + +### CPU Efficiency (IPC) Comparison + +```mermaid +xychart-beta + title "CPU Efficiency (IPC) Comparison - 2 Decimals" + x-axis ["D", "Rust", "Fortran", "Swift", "Crystal", "Nim", "Haskell", "C++", "Objective-C", "Zig", "Odin", "Ruby", "Elixir", "Kotlin", "Dart", "TypeScript", "Bash", "PHP", "Erlang", "Perl"] + y-axis "IPC (Instructions Per Cycle)" 0 --> 4 + bar [4.0, 3.11, 3.11, 3.03, 2.98, 2.88, 2.75, 2.6, 2.57, 2.56, 2.42, 2.42, 2.37, 2.34, 2.33, 2.29, 2.29, 2.28, 2.27, 2.26] +``` + +### Time vs Memory Trade-off + +```mermaid +graph TD + subgraph "Time vs Memory Trade-off - 2 Decimals" + Crystal["Crystal
Time: 22ms
Memory: 3MB"] + D["D
Time: 24ms
Memory: 2MB"] + Zig["Zig
Time: 25ms
Memory: 2MB"] + C++["C++
Time: 26ms
Memory: 1MB"] + Fortran["Fortran
Time: 26ms
Memory: 1MB"] + Nim["Nim
Time: 27ms
Memory: 1MB"] + Rust["Rust
Time: 27ms
Memory: 1MB"] + C["C
Time: 27ms
Memory: 1MB"] + Objective-C["Objective-C
Time: 27ms
Memory: 5MB"] + Lua["Lua
Time: 29ms
Memory: 1MB"] + end +``` + +## Detailed Results + +See the full test output in `reports/run_2_output.txt`. + +--- +*Generated from Pi Calculation Benchmark - Apple A18 Pro Performance Study* diff --git a/reports/5_decimals_mermaid.md b/reports/5_decimals_mermaid.md new file mode 100644 index 0000000..b13d1de --- /dev/null +++ b/reports/5_decimals_mermaid.md @@ -0,0 +1,112 @@ +# 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) | Instructions | Cycles | IPC | Type | +|------|-----------|-----------|----------------|--------------|---------|-----|------| +| 1 | Crystal | 22 | 3293184 | 29546282 | 9885445 | 2.98 | Compiled | +| 2 | D | 24 | 2479445 | 80920081 | 20218601 | 4.00 | Compiled | +| 3 | Zig | 25 | 2981888 | 63916095 | 24932859 | 2.56 | Compiled | +| 4 | C++ | 26 | 1523712 | 23545731 | 9050444 | 2.60 | Compiled | +| 5 | Fortran | 26 | 1802240 | 27378187 | 8787318 | 3.11 | Compiled | +| 6 | Nim | 27 | 1572864 | 15728237 | 5449577 | 2.88 | Compiled | +| 7 | Rust | 27 | 1687552 | 15233650 | 4898110 | 3.11 | Compiled | +| 8 | C | 27 | 1687552 | 14479010 | 6499773 | 2.22 | Compiled | +| 9 | Objective-C | 27 | 6045696 | 27238699 | 10593613 | 2.57 | Compiled | +| 10 | Lua | 29 | 2091690 | 17419324 | 8017680 | 2.17 | Interpreted | +| 11 | Swift | 30 | 6083925 | 50037590 | 16493503 | 3.03 | Compiled | +| 12 | Odin | 30 | 1731242 | 16241385 | 6689690 | 2.42 | Compiled | +| 13 | Go | 31 | 4041386 | 19473738 | 8671903 | 2.24 | Compiled | +| 14 | Assembly | 32 | 1409024 | 12558975 | 6069377 | 2.06 | Compiled | +| 15 | Bash | 34 | 2058922 | 18550685 | 8090090 | 2.29 | Interpreted | +| 16 | Dart | 35 | 14641834 | 63451402 | 27183385 | 2.33 | JIT | +| 17 | Haskell | 46 | 12053162 | 49928755 | 18118511 | 2.75 | Compiled | +| 18 | Brainfuck | 56 | 9185962 | 17501272 | 8126562 | 2.15 | Interpreted | +| 19 | Perl | 58 | 12506453 | 17355692 | 7662235 | 2.26 | Interpreted | +| 20 | Python | 60 | 9737557 | 17485978 | 7928968 | 2.20 | Interpreted | +| 21 | CSharp | 64 | 41462442 | 17452260 | 8624146 | 2.02 | JIT | +| 22 | Kotlin | 65 | 45208917 | 17527899 | 7459125 | 2.34 | JIT | +| 23 | Java | 68 | 43073536 | 17776760 | 8998434 | 1.97 | JIT | +| 24 | PHP | 95 | 26624000 | 17546554 | 7685481 | 2.28 | Interpreted | +| 25 | Ruby | 96 | 28934144 | 17400986 | 7174843 | 2.42 | Interpreted | +| 26 | JavaScript | 118 | 44417024 | 18142055 | 9003896 | 2.01 | Interpreted | +| 27 | Erlang | 185 | 77048490 | 17696158 | 7782102 | 2.27 | Interpreted | +| 28 | Julia | 190 | 236235434 | 17691121 | 7819185 | 2.26 | JIT | +| 29 | R | 220 | 91253418 | 18177908 | 8751540 | 2.07 | Interpreted | +| 30 | Elixir | 406 | 89161728 | 17505478 | 7380020 | 2.37 | Interpreted | +| 31 | Scala | 471 | 55973205 | 18880700 | 8929948 | 2.11 | JIT | +| 32 | TypeScript | 1361 | 208289792 | 17642488 | 7699920 | 2.29 | Interpreted | + +## Visualizations + +### Execution Time Comparison + +```mermaid +xychart-beta + title "Execution Time Comparison - 5 Decimals" + x-axis ["Crystal", "D", "Zig", "C++", "Fortran", "Nim", "Rust", "C", "Objective-C", "Lua", "Swift", "Odin", "Go", "Assembly", "Bash", "Dart", "Haskell", "Brainfuck", "Perl", "Python"] + y-axis "Time (ms)" 0 --> 26 + bar [22, 24, 25, 26, 26, 27, 27, 27, 27, 29, 30, 30, 31, 32, 34, 35, 46, 56, 58, 60] +``` + +### Memory Usage Comparison + +```mermaid +xychart-beta + title "Memory Usage Comparison - 5 Decimals" + x-axis ["Assembly", "C++", "Nim", "Rust", "C", "Odin", "Fortran", "Bash", "Lua", "D", "Zig", "Crystal", "Go", "Objective-C", "Swift", "Brainfuck", "Python", "Haskell", "Perl", "Dart"] + y-axis "Memory (MB)" 0 --> 1 + bar [1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 5, 5, 8, 9, 11, 11, 13] +``` + +### CPU Efficiency (IPC) Comparison + +```mermaid +xychart-beta + title "CPU Efficiency (IPC) Comparison - 5 Decimals" + x-axis ["D", "Rust", "Fortran", "Swift", "Crystal", "Nim", "Haskell", "C++", "Objective-C", "Zig", "Odin", "Ruby", "Elixir", "Kotlin", "Dart", "TypeScript", "Bash", "PHP", "Erlang", "Perl"] + y-axis "IPC (Instructions Per Cycle)" 0 --> 4 + bar [4.0, 3.11, 3.11, 3.03, 2.98, 2.88, 2.75, 2.6, 2.57, 2.56, 2.42, 2.42, 2.37, 2.34, 2.33, 2.29, 2.29, 2.28, 2.27, 2.26] +``` + +### Time vs Memory Trade-off + +```mermaid +graph TD + subgraph "Time vs Memory Trade-off - 5 Decimals" + Crystal["Crystal
Time: 22ms
Memory: 3MB"] + D["D
Time: 24ms
Memory: 2MB"] + Zig["Zig
Time: 25ms
Memory: 2MB"] + C++["C++
Time: 26ms
Memory: 1MB"] + Fortran["Fortran
Time: 26ms
Memory: 1MB"] + Nim["Nim
Time: 27ms
Memory: 1MB"] + Rust["Rust
Time: 27ms
Memory: 1MB"] + C["C
Time: 27ms
Memory: 1MB"] + Objective-C["Objective-C
Time: 27ms
Memory: 5MB"] + Lua["Lua
Time: 29ms
Memory: 1MB"] + end +``` + +## Detailed Results + +See the full test output in `reports/run_5_output.txt`. + +--- +*Generated from Pi Calculation Benchmark - Apple A18 Pro Performance Study*