雨谷の日和

過去19年で2,600を超えるアニメの第1話だけは見続けた僕のお勧めアニメがハズレなはずがない

Javaでの行列式計算(ループ、動的、最適化有)

次に最適化有りにして実行してみよう。

result: 489261678

Flat profile of 12.36 secs (761 total ticks): main

  Interpreted + native   Method                        
  0.1%     0  +     1    sun.net.www.URLConnection.
  0.1%     0  +     1    java.lang.String.length
  0.3%     0  +     2    Total interpreted

     Compiled + native   Method                        
 99.6%   743  +     9    Test.expand
 99.6%   743  +     9    Total compiled

  Runtime stub + native  Method                        
  0.1%     1  +     0    new_type_array
  0.1%     1  +     0    Total runtime stubs

  Thread-local ticks:
  0.8%     6             Blocked (of total)


Global summary of 12.36 seconds:
100.0%   791             Received ticks
  3.2%    25             Received GC ticks
  0.5%     4             Other VM operations

なんと処理終了までに約12秒もかかった。
再帰有りの場合と比べても約1.5倍の性能劣化である。