Closed Liutos closed 2 years ago
由于之前用动态作用域的方式实现了函数参数的查找方式,导致效率很差。替换为词法作用域后快多了
INTERPRETER> (time (with-open-file (s "~/SourceCode/ttt/pro3.lisp")
(com.liutos.liutcl.interpreter:load-source-file s)))
6857
Evaluation took:
0.090 seconds of real time
0.089874 seconds of total run time (0.087894 user, 0.001980 system)
[ Run times consist of 0.007 seconds GC time, and 0.083 seconds non-GC time. ]
100.00% CPU
199,728,408 processor cycles
76,962,880 bytes consed
#<<VALUE-NUM> 6857>
用于解决 Project Euler 第三题的代码如下
在我的设备上,它需要执行五秒钟才能得到结果。
效率还有非常大的优化空间。