神刀安全网

Profiling clojurescript with KLIPSE

Let’s say that you want to profile a piece of code in clojurescript. There is a cool macro for that in clojurescript: time .

time evaluates an expression and prints the time it took and returns the value of the expression.

The interesting question is:

Where does time print the time it took?

Usually, it prints in the browser console. This is because, you have probably called (enable-console-print!) somewhere in your code.

But as aKLIPSE user, you want the time to be displayed in the evaluation rectangle instead of inside the console.

It’s simple to achieve that using with-out-str .

Let’s see it in action by comparing the running time of two naive implementations for prime number generation:

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » Profiling clojurescript with KLIPSE

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
分享按钮