では、昨日のソースコードを実行してみよう。
まずは最適化無しで実測を行ってみる。
result: 489261678 Flat profile of 154.12 secs (9749 total ticks): main Interpreted + native Method 99.6% 9178 + 459 Test.expand 0.0% 0 + 1 java.io.WinNTFileSystem.getBooleanAttributes 0.0% 0 + 1 java.lang.Throwable.fillInStackTrace 99.7% 9178 + 461 Total interpreted Thread-local ticks: 0.8% 78 Blocked (of total) 0.3% 29 Unknown: running frame 0.0% 3 Unknown: thread_state Global summary of 154.13 seconds: 100.0% 9777 Received ticks 0.3% 25 Received GC ticks 0.0% 1 Other VM operations 0.3% 32 Unknown code
約154秒という結果となった。再帰有りの場合に比べ、1.5倍以上の性能劣化である。
うーむ。どうも、再帰がループになると速くなるというのは一概にはそう言い切れないような結果に見えるのだが。
ともかく、他の実測も続けよう。