Scalaのコンパイル時間計測方法

2
eiríkr is gone @d6

@xuwei_k Have you tried 2.10.2 though? Spire compiles 5x faster on 2.10.2 than 2.10.4.

2014-04-24 02:58:34
eiríkr is gone @d6

@milessabin @xuwei_k I just tested it from clean recently. I'm not sure what's going on, but it's one reason I didn't update to 2.10.3.

2014-04-24 03:01:25
kmizu @kmizu

nscala-time、何度か繰り返し計測してみたけど、2.10.4で15s、2.11.0で18sと遅くなってるなあ。何か計測時のセッティング間違えたかなあ。

2014-04-28 22:31:18
kmizu @kmizu

あ、 https://t.co/RYqcuM37Dt はビルド時間の計測です。

2014-04-28 22:32:01
kmizu @kmizu

build.sbtから設定読み込む時間が入ってるから狂いがあるかなあ。もうちょっと公平な条件でくり返してみよう。

2014-04-28 22:33:44
kmizu @kmizu

計測対象のOSでも変わる可能性あるな…。

2014-04-28 22:35:01
Kenji Yoshida @xuwei_k

@kmizu 設定読みこむ時間・・・?どうやってやったんですか? 自分は sbt clean update compile として、最後のcompileの時間だけ計測という方法でやりましたが。

2014-04-28 23:22:00
kmizu @kmizu

Windows 7 UltimateとUbuntu Linux 14.04でnscala-timeのコンパイル時間を比較したのだが、3秒くらいWindows 7の方が速い気がするのは気のせいか。

2014-04-28 23:23:29
kmizu @kmizu

まあ、他の条件が色々違ってるのであまりあてにはならないが。

2014-04-28 23:23:49
kmizu @kmizu

@xuwei_k はい。自分もそうしました。より正確には、 $ sbt clean $ sbt update $ time sbt compile ですかね(sbtコンソール中で続けてしなくてもresolveの結果はキャッシュされてるみたいなので)。

2014-04-28 23:25:16
Josh Suereth @jsuereth

@kmizu @xuwei_k It's actually `update` that takes a ton of time, generally, after a clean.

2014-04-28 23:26:47
kmizu @kmizu

@xuwei_k timeコマンドの結果はbuild.sbtを読み込む時間その他諸々含まれてしまいますね(計測時間としては、sbtの表示時間任せではなく、timeコマンドを使ったスクリプト作って繰り返し計測したいのが悩ましい)。

2014-04-28 23:27:15
Josh Suereth @jsuereth

@kmizu @xuwei_k @eed3si9n_ja counted upwards of 30 reads of the same file by ivy on resolution..

2014-04-28 23:27:23
Kenji Yoshida @xuwei_k

@kmizu なるほど。updateのあと"sbt compile"で起動やり直すと、起動してコンパイル始めるまでの時間がコンパイル時間に比べてある程度あったら、誤差増えてあまり正確に計測できなそうですね。そもそもnscala-timeはあまり大きくなくてコンパイル時間短いですし

2014-04-28 23:29:25
kmizu @kmizu

@jsuereth @xuwei_k @eed3si9n_ja Thanks! I'm surprised with you reply :-) I understood that my way was wrong in fact.

2014-04-28 23:32:12
Josh Suereth @jsuereth

@kmizu @xuwei_k @eed3si9n_ja Directly calling update means you hit the slowness EVERY TIME. We have a cache to try to prevent that.

2014-04-28 23:33:35
kmizu @kmizu

@jsuereth @xuwei_k @eed3si9n_ja BTW, how do you measure the compilation time of a library ? I want the way as the following:

2014-04-28 23:34:24
kmizu @kmizu

@xuwei_k それでもコンパイル時間15s~18sくらいあるから(sbtの表示時間)、計測するには十分なくらいかなとは思うんですよね。

2014-04-28 23:35:56
Josh Suereth @jsuereth

@kmizu @xuwei_k @eed3si9n_ja -Dsbt.task.timings=true will give you detailed task timing information, sorted by most expensive tasks

2014-04-28 23:37:39
Josh Suereth @jsuereth

@kmizu @xuwei_k @eed3si9n_ja That should tell you how long compile task itself takes.

2014-04-28 23:37:51
kmizu @kmizu

@jsuereth @xuwei_k @eed3si9n_ja * easily repeatable * high precision * portable

2014-04-28 23:42:01
Josh Suereth @jsuereth

@kmizu @xuwei_k @eed3si9n_ja Also, precision is a bit rough to do. You need to read a high precision timer. not sure what the JVM uses.

2014-04-28 23:43:25
Josh Suereth @jsuereth

@kmizu @xuwei_k @eed3si9n_ja But you should get decent precision for long tasks and terrible precision for short tasks (<1 ms).

2014-04-28 23:43:56