How Do I profile my functions using DrScheme?
如何使用DrScheme配置我的功能?
(require profile)
(define (factorial n)
(cond
((= n 1) 1)
(else (* n (factorial (- n 1))))))
(profile factorial)
The above code returns
上面的代码返回
Profiling results
-----------------
Total cpu time observed: 0ms (out of 0ms)
Number of samples taken: 0 (once every 0ms)
====================================
Caller
Idx Total Self Name+srcLocal%
ms(pct) ms(pct) Callee
====================================
>
I tried: - (profile (factorial 100))
- (profile factorial) (factorial 100)
But it gives me the same result. What am I doing wrong?
我试过: - (profile(factorial 100)) - (profile factorial)(factorial 100)但它给了我相同的结果。我究竟做错了什么?
2 个解决方案
#1
I'm not familiar with the profile
module in PLT Scheme, but perhaps you have to actually call the function?
我不熟悉PLT Scheme中的配置文件模块,但也许您必须实际调用该函数?
(profile (factorial 1000))
#2
Have you tried cranking up N in (profile (factorial N)) until there's a noticeable pause?
你有没有尝试过N((配置文件(因子N)),直到有明显的停顿?
(factorial 100) is the kind of thing a modern computer should be able to do in <1ms.
(factorial 100)是现代计算机应该能够在<1ms内完成的事情。
Just skimming the documentation makes me suspect its just a matter of factorial being too fast to easily profile for that case.
只是略读文档让我怀疑它只是一个因素太快而不能轻易分析该案例的问题。
#1
I'm not familiar with the profile
module in PLT Scheme, but perhaps you have to actually call the function?
我不熟悉PLT Scheme中的配置文件模块,但也许您必须实际调用该函数?
(profile (factorial 1000))
#2
Have you tried cranking up N in (profile (factorial N)) until there's a noticeable pause?
你有没有尝试过N((配置文件(因子N)),直到有明显的停顿?
(factorial 100) is the kind of thing a modern computer should be able to do in <1ms.
(factorial 100)是现代计算机应该能够在<1ms内完成的事情。
Just skimming the documentation makes me suspect its just a matter of factorial being too fast to easily profile for that case.
只是略读文档让我怀疑它只是一个因素太快而不能轻易分析该案例的问题。