[BACK]Return to tune1.k CVS log [TXT][DIR] Up to [local] / OpenXM / src / k097 / debug

Annotation of OpenXM/src/k097/debug/tune1.k, Revision 1.1.1.1

1.1       maekawa     1:
                      2:
                      3: def foo10() {
                      4:   local i,n,keys;
                      5:   sm1(" set_timer ");
                      6:   n = Length(Helplist);
                      7:   keys = [" " ];  /* This is a gate keeper for shell. */
                      8:   PSfor (i=0; i< n; i++ ) {
                      9:     keys = Append(keys,Helplist[i,0]);
                     10:   }
                     11:   sm1(" set_timer ");
                     12:   sm1(" set_timer ");
                     13:   keys = sm1(keys," shell ");
                     14:   sm1(" set_timer ");
                     15: }
                     16:
                     17: def foo20() {
                     18:   local i,n,keys;
                     19:   sm1(" set_timer ");
                     20:   n = Length(Helplist);
                     21:   keys = [" " ];  /* This is a gate keeper for shell. */
                     22:   PSfor (i=0; i< n; i++ ) {
                     23:     keys = dummyf(keys,Helplist[i,0]);
                     24:   }
                     25:   sm1(" set_timer ");
                     26: }
                     27:
                     28: def dummyf(a,b) {
                     29:   ;
                     30: }
                     31:
                     32: /*   1997, 6/1 (日曜日)
                     33:     n = 68
                     34:
                     35: In[13]=foo10();
                     36: User time: 0.866667 seconds, System time: 0.000000 seconds
                     37: User time: 0.766667 seconds, System time: 0.000000 seconds: shell sort の時間
                     38: In[14]=foo20();
                     39: User time: 0.633333 seconds, System time: 0.000000 seconds
                     40:
                     41:     foo10 と foo20 では, 0.2 秒程度の差しかない.
                     42:     したがって, append では, Helplist[i,0] の取り出しと,
                     43:     局所変数の処理にほとんどの時間が使われていると予想できる.
                     44:
                     45: */
                     46:
                     47: def foo30() {
                     48:   local i,n,keys;
                     49:   sm1(" set_timer ");
                     50:   n = Length(Helplist);
                     51:   keys = [" " ];  /* This is a gate keeper for shell. */
                     52:   PSfor (i=0; i< n; i++ ) {
                     53:     keys = dummyf(keys,i); /* 配列要素のとりだしなし */
                     54:   }
                     55:   sm1(" set_timer ");
                     56: }
                     57:
                     58: /* foo30() は, 0.48 秒.  よって, 配列要素の取り出しに, 0.2 秒程度かかっている.
                     59: */
                     60:
                     61:
                     62: def foo40() {
                     63:   local i,n,keys;
                     64:   n = Length(Helplist);
                     65:   keys = [" " ];  /* This is a gate keeper for shell. */
                     66:   sm1(" set_timer ");
                     67:   PSfor (i=0; i< n; i++ ) {
                     68:     keys = dummyf(keys,i); /* 配列要素のとりだしなし */
                     69:   }
                     70:   sm1(" set_timer ");
                     71: }
                     72: /* これは, 0.46 秒.  Length の計算は, 0.02 秒 */
                     73:
                     74: /* 関数呼び出しは, 0.5 秒, 配列要素の取り出しが, 0.2秒 */
                     75:
                     76:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>