トップ «前の日記(2006-09-08) 最新 次の日記(2006-09-10)» 編集

ヨタの日々

2001|08|09|10|11|12|
2002|01|02|03|04|05|06|07|08|09|10|11|12|
2003|01|02|03|04|05|06|07|08|09|10|11|12|
2004|01|02|03|04|05|06|07|08|09|10|11|12|
2005|01|02|03|04|05|06|07|08|09|10|11|12|
2006|01|02|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|04|05|06|07|08|09|10|11|12|
2012|01|02|03|04|05|06|07|08|09|10|11|12|
2013|01|02|03|04|05|06|07|08|09|10|11|12|
2014|01|02|03|04|05|06|07|08|09|10|11|12|
2015|01|02|03|04|05|06|07|08|09|10|11|12|
2016|01|02|03|04|05|06|07|08|09|10|11|12|
2017|01|02|03|04|05|06|07|08|09|10|11|12|
2018|01|02|03|04|05|06|07|08|09|10|11|12|
2019|01|02|03|04|05|06|07|08|09|10|11|12|
2020|01|02|03|04|05|06|07|08|09|10|11|12|
2021|01|02|03|04|05|06|07|08|09|10|11|12|
2022|01|02|03|04|05|06|07|08|09|10|11|12|
2023|01|02|03|04|05|06|07|08|12|
2024|01|02|03|04|

2006-09-09

_

0830 起床。

ねむねむ。

_ おやつ

蕎麦まんじゅう。松江土産

img_1409.jpg

_ おやつ( 2 )

亀じるし の吉原殿中

img_1410.jpg

_ おやつ( 3 )

ままどーる。

img_1412.jpg

_ おやつ( 4 )

川崎大師のみそせんべい

img_1413.jpg

_ tDiary が重過ぎる件について

どこにボトルネックがあるのか調べてみた。

  • 原因 : amazon.rb かなあ
  • 対策 : ハードウェアの性能を上げるのか?

参考

参考までに ただただしさんとこはこれくらい

%time w3m -dump http://sho.tdiary.net/
0.06s user 0.05s system 13% cpu 0.747 total

最初

現状で計測。

% time w3m -dump http://www.area51.gr.jp/~rin/diary/
0.14s user 0.03s system 6% cpu 2.793 total
% cd ~/public_html/diary
% sudo -u www sh -c 'echo "" | ruby -rprofile index.rb 1>/dev/null'
  %   cumulative   self              self     total
 time   seconds   seconds    calls  ms/call  ms/call  name
 11.65     5.98      5.98      448    13.35    23.24  REXML::Parsers::BaseParser#pull
  4.89     8.49      2.51        2  1255.00 11580.00  REXML::Parsers::TreeParser#parse
  4.07    10.58      2.09      134    15.60    68.43  Kernel.require
  3.43    12.34      1.76      561     3.14     9.73  REXML::Element#root
  3.33    14.05      1.71      553     3.09    28.73  Array#each
  2.94    15.56      1.51       26    58.08   358.85  Array#delete_if
  2.92    17.06      1.50      191     7.85    88.74  REXML::Element#namespace
  2.71    18.45      1.39      191     7.28    22.36  REXML::Attributes#get_attribute
  2.30    19.63      1.18      336     3.51    16.67  REXML::Elements#add
  2.03    20.67      1.04      168     6.19    39.11  REXML::Element#add_element
  1.81    21.60      0.93     2619     0.36     0.36  Kernel.kind_of?

amazon.rb

上位にきてる REXML は amazon.rb が使っているようだ

% cd ~/public_html/diary
% grep -r REXML *
misc/plugin/amazon/amazonimg.rb:        doc = REXML::Document::new( xml ).root
misc/plugin/amazon.rb:                  doc = REXML::Document::new( xml ).root

amzon.rb を外して計測。

% sudo -u www sh -c 'echo "" | ruby -rprofile index.rb 1>/dev/null'
  %   cumulative   self              self     total
 time   seconds   seconds    calls  ms/call  ms/call  name
 39.98    19.13     19.13        7  2732.86  5104.29  ERB::Compiler::SimpleScanner2#scan
 11.47    24.62      5.49    13434     0.41     0.59  Kernel.===
  5.39    27.20      2.58    14482     0.18     0.18  String#==
  3.45    28.85      1.65       62    26.61   105.81  Kernel.require
  2.53    30.06      1.21     4498     0.27     0.27  StringScanner#[]
  2.51    31.26      1.20      932     1.29     1.83  ERB::Compiler::Buffer#cr
  2.38    32.40      1.14     5055     0.23     0.23  String#<<
  2.36    33.53      1.13     1809     0.62     0.85  ERB::Compiler::Buffer#push
  1.73    34.36      0.83     4652     0.18     0.18  String#empty?
  1.53    35.09      0.73      181     4.03    51.88  Array#each
  1.50    35.81      0.72       80     9.00   333.12  Kernel.eval
  1.32    36.44      0.63     2249     0.28     0.28  StringScanner#scan
  1.27    37.05      0.61       33    18.48    26.36  Date#_parse

erb

高速化ガイドにしたがって erbscan を入れてみる

% wget http://www.moonwolf.com/ruby/archive/erbscan-0.0.20030723b.tar.gz
% tar xzf erbscan-0.0.20030723b.tar.gz
% cd erbscan-0.0.20030723b
% ruby extconf.rb
% make
% sudo make install
% sudo apachectl restart

計測。

% time w3m -dump http://www.area51.gr.jp/~rin/diary/
0.11s user 0.06s system 8% cpu 1.967 total
% sudo -u www sh -c 'echo "" | ruby -rprofile index.rb 1>/dev/null'
  %   cumulative   self              self     total
 time   seconds   seconds    calls  ms/call  ms/call  name
 13.21     1.39      1.39       63    22.06   100.32  Kernel.require
  6.27     2.05      0.66      153     4.31    58.04  Array#each
  4.94     2.57      0.52       74     7.03    82.70  Kernel.eval
  4.47     3.04      0.47       33    14.24    34.55  Date#_parse
  3.23     3.38      0.34      171     1.99     2.28  Module#module_eval
  3.23     3.72      0.34      425     0.80     0.80  String#to_i
  2.85     4.02      0.30     1468     0.20     0.20  Module#method_added
  2.66     4.30      0.28      132     2.12    17.50  #<TDiary::Plugin:0x84a36b8>.rss_recent_convert
  2.47     4.56      0.26       65     4.00    18.15  Kernel.instance_eval
  2.09     4.78      0.22     1087     0.20     0.20  String#==
  1.90     4.98      0.20      704     0.28     0.36  Hash#[]

amazon.rb あり

この状態でもう一度 amazon.rb を付けてみる。

計測。

%time w3m -dump http://www.area51.gr.jp/~rin/diary/
0.11s user 0.04s system 5% cpu 2.468 total
% sudo -u www sh -c 'echo "" | ruby -rprofile index.rb 1>/dev/null'
  %   cumulative   self              self     total
 time   seconds   seconds    calls  ms/call  ms/call  name
 12.02     5.16      5.16      448    11.52    19.26  REXML::Parsers::BaseParser#pull
  5.08     7.34      2.18      135    16.15    68.96  Kernel.require
  5.01     9.49      2.15        2  1075.00  9620.00  REXML::Parsers::TreeParser#parse
  3.33    10.92      1.43      561     2.55     7.15  REXML::Element#root
  2.87    12.15      1.23      191     6.44    20.79  REXML::Attributes#get_attribute
  2.45    13.20      1.05      553     1.90    25.68  Array#each

mod_ruby

mod_ruby 入れてみた。

time w3m -dump http://www.area51.gr.jp/~rin/diary/
0.13s user 0.03s system 5% cpu 2.755 total
% sudo -u www sh -c 'echo "" | ruby -rprofile index.rb 1>/dev/null'
  %   cumulative   self              self     total
 time   seconds   seconds    calls  ms/call  ms/call  name
 11.78     5.08      5.08      448    11.34    20.56  REXML::Parsers::BaseParser#pull
  4.75     7.13      2.05      135    15.19    69.85  Kernel.require
  4.15     8.92      1.79        2   895.00  9835.00  REXML::Parsers::TreeParser#parse
  3.20    10.30      1.38       26    53.08   266.92  Array#delete_if
  3.11    11.64      1.34      553     2.42    26.02  Array#each
  2.85    12.87      1.23      561     2.19     6.51  REXML::Element#root
  2.48    13.94      1.07      191     5.60    62.77  REXML::Element#namespace
  1.67    14.66      0.72      276     2.61     3.04  REXML::Child#parent=

変わらないか。

ということで mod_ruby は外す。

対策

  • amazon.rb 無し
  • erbscan 導入

というところだが、いまさら amazon.rb 無しでは暮らせないので困った。