diff --git a/README.md b/README.md index 375113b..5e795a2 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,33 @@ Replace `[file]` with the path to your input file. ## Performance Summary +**Version:** 0.4.3-alpha (Tree-walker Interpreter) +**Test Hardware:** i5-13490F, Windows 11 + +**Execution Times for Fibonacci(30):** + +* Naive Recursion: **5.47s** (~2.14× faster than 0.4.2-alpha) +* Memoization: **0.55ms** (~1.69× faster than 0.4.2-alpha) +* Iteration: **0.10ms** (~3.73× faster than 0.4.2-alpha) +* Tail Recursion: **0.16ms** (~2.55× faster than 0.4.2-alpha) + +**Visual Comparison:** + +``` +Naive Recursion : █████████████████████████ 5.47s +Memoization : ▉ 0.55ms +Iteration : ▍ 0.10ms +Tail Recursion : ▎ 0.16ms +``` + +**Key Insight:** Algorithm choice still dominates performance, while 0.4.3-alpha shows significant improvements in function call and loop efficiency. + +**Detailed Reports:** [English](./docs/benchmark_result/0.4.3-alpha/benchmark_result_en_0.4.3-alpha.pdf) | [中文](./docs/benchmark_result/0.4.3-alpha/benchmark_result_zh_0.4.3-alpha.pdf) + + + + + **Version:** 0.4.2-alpha (Tree-walker Interpreter) **Test Hardware:** i5-13490F, Windows 11 @@ -96,7 +123,7 @@ Tail Recursion : ▎ 0.40ms **Key Insight:** Algorithm choice dominates performance in this tree-walker implementation. -**Detailed Reports:** [English](./docs/benchmark_result/benchmark_result_en_0.4.2-alpha.md) | [中文](./docs/benchmark_result/benchmark_result_zh_0.4.2-alpha.md) +**Detailed Reports:** [English](./docs/benchmark_result/0.4.2-alpha/benchmark_result_en_0.4.2-alpha.pdf) | [中文](./docs/benchmark_result/0.4.2-alpha/benchmark_result_zh_0.4.2-alpha.pdf) ## Language Documents diff --git a/README_ZH-CN.md b/README_ZH-CN.md index 438e315..601ee9d 100644 --- a/README_ZH-CN.md +++ b/README_ZH-CN.md @@ -66,6 +66,30 @@ Fig 围绕几个核心原则设计: ## 性能概览 +**版本:** 0.4.3-alpha (树遍历解释器) +**测试硬件:** i5-13490F, Windows 11 + +**计算 Fibonacci(30) 的执行时间:** + +* 朴素递归: **5.47秒** (~比0.4.2-alpha快2.14倍) +* 记忆化: **0.55毫秒** (~比0.4.2-alpha快1.69倍) +* 迭代: **0.10毫秒** (~比0.4.2-alpha快3.73倍) +* 尾递归: **0.16毫秒** (~比0.4.2-alpha快2.55倍) + +**可视化对比:** + +``` +朴素递归 : █████████████████████████ 5.47秒 +记忆化递归 : ▉ 0.55毫秒 +迭代算法 : ▍ 0.10毫秒 +尾递归 : ▎ 0.16毫秒 +``` + +**核心发现:** 算法选择仍然主导性能,同时 0.4.3-alpha 在函数调用和循环效率上有明显提升。 + +**详细报告:** [English](./docs/benchmark_result/0.4.3-alpha/benchmark_result_en_0.4.3-alpha.pdf) | [中文](./docs/benchmark_result/0.4.3-alpha/benchmark_result_zh_0.4.3-alpha.pdf) + + **版本:** 0.4.2-alpha (树遍历解释器) **测试硬件:** i5-13490F, Windows 11 @@ -85,7 +109,7 @@ Fig 围绕几个核心原则设计: **核心发现:** 在此树遍历实现中,算法选择主导性能表现。 -**详细报告:** [English](./docs/benchmark_result/benchmark_result_en_0.4.2-alpha.md) | [中文](./docs/benchmark_result/benchmark_result_zh_0.4.2-alpha.md) +**详细报告:** [English](./docs/benchmark_result/0.4.2-alpha/benchmark_result_en_0.4.2-alpha.pdf) | [中文](./docs/benchmark_result/0.4.2-alpha/benchmark_result_zh_0.4.2-alpha.pdf) ## 语言文档 diff --git a/docs/benchmark_result/benchmark_result_en_0.4.2-alpha.md b/docs/benchmark_result/0.4.2-alpha/benchmark_result_en_0.4.2-alpha.md similarity index 100% rename from docs/benchmark_result/benchmark_result_en_0.4.2-alpha.md rename to docs/benchmark_result/0.4.2-alpha/benchmark_result_en_0.4.2-alpha.md diff --git a/docs/benchmark_result/0.4.2-alpha/benchmark_result_en_0.4.2-alpha.pdf b/docs/benchmark_result/0.4.2-alpha/benchmark_result_en_0.4.2-alpha.pdf new file mode 100644 index 0000000..e4c7c81 Binary files /dev/null and b/docs/benchmark_result/0.4.2-alpha/benchmark_result_en_0.4.2-alpha.pdf differ diff --git a/docs/benchmark_result/benchmark_result_zh_0.4.2-alpha.md b/docs/benchmark_result/0.4.2-alpha/benchmark_result_zh_0.4.2-alpha.md similarity index 100% rename from docs/benchmark_result/benchmark_result_zh_0.4.2-alpha.md rename to docs/benchmark_result/0.4.2-alpha/benchmark_result_zh_0.4.2-alpha.md diff --git a/docs/benchmark_result/0.4.2-alpha/benchmark_result_zh_0.4.2-alpha.pdf b/docs/benchmark_result/0.4.2-alpha/benchmark_result_zh_0.4.2-alpha.pdf new file mode 100644 index 0000000..628eca9 Binary files /dev/null and b/docs/benchmark_result/0.4.2-alpha/benchmark_result_zh_0.4.2-alpha.pdf differ diff --git a/docs/benchmark_result/0.4.3-alpha/benchmark_result_en_0.4.3-alpha.md b/docs/benchmark_result/0.4.3-alpha/benchmark_result_en_0.4.3-alpha.md new file mode 100644 index 0000000..88da7b9 --- /dev/null +++ b/docs/benchmark_result/0.4.3-alpha/benchmark_result_en_0.4.3-alpha.md @@ -0,0 +1,163 @@ +# Fig Language Performance Benchmark Report + +## Version: 0.4.3-alpha (Tree Traversal Interpreter) + +### Preface + +This report presents benchmark tests of Fibonacci algorithms in Fig v0.4.3-alpha tree traversal interpreter, compared with version 0.4.2-alpha. Results show significant performance improvements in function calls, loops, and recursion optimizations in 0.4.3-alpha, especially in iterative and tail-recursive implementations. + +### Test Environment + +* **CPU:** Intel Core i5-13490F +* **Operating System:** Windows 11 +* **Interpreter:** Fig Tree Traversal Interpreter v0.4.3-alpha +* **Test Date:** Current execution + +### Executive Summary + +This benchmark evaluates four different Fibonacci algorithm implementations in Fig, computing the 30th Fibonacci number (832,040). Algorithm choice remains the dominant factor for performance, while interpreter improvements in function call and loop efficiency are also reflected. + +## Performance Results + +### Latest Floating Execution Time (0.4.3-alpha) + +| Algorithm | Time (s) | Time (ms) | Relative Speed | +| --------------------------- | ----------- | ---------- | ---------------- | +| `fib` (Naive Recursion) | 5.471 s | 5471.37 ms | 1.00× (baseline) | +| `fib_memo` (Memoization) | 0.0005503 s | 0.5503 ms | 9,950× faster | +| `fib_iter` (Iterative) | 0.0001004 s | 0.1004 ms | 54,500× faster | +| `fib_tail` (Tail Recursion) | 0.0001573 s | 0.1573 ms | 34,800× faster | + +### Comparison with 0.4.2-alpha + +| Algorithm | 0.4.2-alpha Time | 0.4.3-alpha Time | Performance Gain | +| --------------------------- | ---------------- | ---------------- | ---------------- | +| `fib` (Naive Recursion) | 11.721 s | 5.471 s | ~2.14× | +| `fib_memo` (Memoization) | 0.930 ms | 0.550 ms | ~1.69× | +| `fib_iter` (Iterative) | 0.375 ms | 0.100 ms | ~3.73× | +| `fib_tail` (Tail Recursion) | 0.401 ms | 0.157 ms | ~2.55× | + +--- + +## Visual Performance Comparison (Horizontal Bar Placeholder) + +0.4.2-alpha vs 0.4.3-alpha + +**Note:** Each line contains two bars: gray for 0.4.2-alpha, blue for 0.4.3-alpha + +
| Algorithm | Performance Comparison | +
|---|---|
| fib | +
+
+ 11.72 s + + 5.47 s + |
+
| fib_memo | +
+
+ 0.93 ms + + 0.55 ms + |
+
| fib_iter | +
+
+ 0.375 ms + + 0.100 ms + |
+
| fib_tail | +
+
+ 0.401 ms + + 0.157 ms + |
+
| 算法 | 性能对比 | +
|---|---|
| fib | +
+
+ 11.72 s + + 5.47 s + |
+
| fib_memo | +
+
+ 0.93 ms + + 0.55 ms + |
+
| fib_iter | +
+
+ 0.375 ms + + 0.100 ms + |
+
| fib_tail | +
+
+ 0.401 ms + + 0.157 ms + |
+