[#46732] ヒアドキュメント内の変数展開が正常に行われない — ShingoKintaka <kamuycikap@...>

Ruby  :1.8.7 (Ubuntu9.10)

12 messages 2010/01/05
[#46733] Re: ヒアドキュメント内の変数展開が正常に行われない — rubikitch@... 2010/01/06

From: ShingoKintaka <kamuycikap@tulip.ocn.ne.jp>

[#46800] DLモジュールの使い方 — kouichi_someya@...

染谷と申します。

12 messages 2010/01/20
[#47678] プログラム実行時に「[BUG] Segmentation fault」 — 染谷 康一 <kouichi_someya@...> 2010/12/09

染谷と申します。

[ruby-list:46762] httpclientとhtmlsplitの併用

From: AOKI Shigeru <saoki@...>
Date: 2010-01-12 16:19:24 UTC
List: ruby-list #46762
青木と申します。

httpclient(http://raa.ruby-lang.org/project/httpclient/)
をrequireすると、htmlsplit(http://www.moonwolf.com/ruby/)
の動作がものすごく遅くなります。
回避策はありますでしょうか。
(a.txtは45KBほどのHTMLファイルです)

[stest.rb]
require 'htmlsplit'
html = open('a.txt').read
HTMLSplit.new(html)


C:\work>ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i386-mswin32]
C:\work>ruby -r profile stest.rb
  %   cumulative   self              self     total
 time   seconds   seconds    calls  ms/call  ms/call  name
 63.15    36.59     36.59        1 36586.00 57766.00  String#each_byte
 16.50    46.15      9.56   265550     0.04     0.04  Symbol#===
  5.29    49.21      3.06    32635     0.09     0.12  Kernel.===
  3.02    50.96      1.75    53992     0.03     0.03  String#==
  2.88    52.63      1.67    43398     0.04     0.04  Integer#chr
  2.48    54.06      1.44    34806     0.04     0.04  String#<<
  2.23    55.35      1.29     1192     1.08     1.70  Array#include?
  1.67    56.32      0.96    27797     0.03     0.03  Fixnum#==
  0.80    56.78      0.47    11143     0.04     0.04  Regexp#===
  0.29    56.95      0.17     1125     0.15     0.22  CGI#unescapeHTML
  0.24    57.09      0.14     2518     0.06     0.06  String#downcase
  0.21    57.22      0.12     1991     0.06    29.24  Class#new
  0.16    57.31      0.10      507     0.19     0.25  StartTag#initialize
  0.14    57.39      0.08      506     0.16     0.22  EndTag#initialize
  0.14    57.47      0.08        6    13.17    60.17  Kernel.require
  0.13    57.55      0.08     1125     0.07     0.07  String#gsub
  0.11    57.61      0.06     1656     0.04     0.04  String#[]
  0.11    57.67      0.06     1989     0.03     0.03  Array#<<
  0.08    57.72      0.05        3    15.67    20.67  Array#each
  0.08    57.77      0.05      179     0.26     0.35  EmptyElementTag#initialize

  0.08    57.81      0.05     1298     0.04     0.04  Hash#[]=
  0.05    57.85      0.03      111     0.28     0.28  Module#module_eval
  0.05    57.88      0.03     1262     0.02     0.02  Fixnum#>
  0.05    57.91      0.03      728     0.04     0.04  CharacterData#initialize
  0.03    57.92      0.02     1262     0.01     0.01  String#length
  0.03    57.94      0.01      308     0.05     0.05  Module#method_added
  0.00    57.94      0.00        1     0.00     0.00  File#initialize
  0.00    57.94      0.00       68     0.00     0.00  Comment#initialize
  0.00    57.94      0.00        1     0.00     0.00  IO#read
  0.00    57.94      0.00        1     0.00     0.00  String#+
  0.00    57.94      0.00     1192     0.00     0.00  String#downcase!
  0.00    57.94      0.00        1     0.00     0.00  Regexp#quote
  0.00    57.94      0.00        1     0.00     0.00  Class#initialize
  0.00    57.94      0.00        4     0.00     0.00  Module#private
  0.00    57.94      0.00        2     0.00     0.00  Module#public_instance_met
hods
  0.00    57.94      0.00       11     0.00     0.00  Module#module_function
  0.00    57.94      0.00        1     0.00     0.00  Regexp#match
  0.00    57.94      0.00        1     0.00     0.00  Array#|
  0.00    57.94      0.00        1     0.00     0.00  String#<=>
  0.00    57.94      0.00       28     0.00     0.00  String#sub
  0.00    57.94      0.00        1     0.00 57766.00  HTMLSplit#initialize
  0.00    57.94      0.00        1     0.00     0.00  Declaration#initialize
  0.00    57.94      0.00       25     0.00     0.00  Kernel.singleton_method_ad
ded
  0.00    57.94      0.00        1     0.00     0.00  Module#attr
  0.00    57.94      0.00       15     0.00     0.00  Class#inherited
  0.00    57.94      0.00        1     0.00     0.00  Comparable.<
  0.00    57.94      0.00        1     0.00     0.00  Kernel.open
  0.00    57.94      0.00       14     0.00     0.00  Module#attr_accessor
  0.00    57.94      0.00      110     0.00     0.00  Fixnum#+
  0.00    57.94      0.00       28     0.00     0.00  Module#define_method
  0.00    57.94      0.00        1     0.00     0.00  Array#-
  0.00    57.94      0.00        1     0.00     0.00  Module#attr_reader
  0.00    57.94      0.00        1     0.00    62.00  Object#DelegateClass
  0.00    57.94      0.00        1     0.00 57938.00  #toplevel

C:\work>ruby -r httpclient -r profile stest.rb
  %   cumulative   self              self     total
 time   seconds   seconds    calls  ms/call  ms/call  name
 70.84   641.68    641.68        1 641681.00 904297.00  String#each_byte
 11.45   745.36    103.68   265550     0.39     0.39  Symbol#===
  6.02   799.87     54.51    32635     1.67     2.04  Kernel.===
  2.79   825.16     25.29     1192    21.22    27.05  Array#include?
  2.16   844.71     19.54    53992     0.36     0.36  String#==
  1.89   861.85     17.15    43398     0.40     0.40  Integer#chr
  1.52   875.63     13.77    34806     0.40     0.40  String#<<
  1.25   886.97     11.34    27797     0.41     0.41  Fixnum#==
  0.50   891.51      4.54    11143     0.41     0.41  Regexp#===
  0.37   894.83      3.32     1991     1.67   457.48  Class#new
  0.22   896.85      2.02     1125     1.80     2.28  CGI#unescapeHTML
  0.11   897.88      1.03      506     2.03     2.34  EndTag#initialize
  0.11   898.85      0.97      507     1.91     2.27  StartTag#initialize
  0.10   899.75      0.90     2518     0.36     0.36  String#downcase
  0.08   900.47      0.72     1989     0.36     0.36  Array#<<
  0.08   901.16      0.69     1656     0.42     0.42  String#[]
  0.07   901.76      0.60     1262     0.48     0.48  String#length
  0.06   902.31      0.54     1125     0.48     0.48  String#gsub
  0.06   902.84      0.53     1262     0.42     0.42  Fixnum#>
  0.05   903.25      0.42      728     0.57     0.57  CharacterData#initialize
  0.04   903.66      0.40        3   135.00   312.33  Array#each
  0.04   904.05      0.39      111     3.51     3.95  Module#module_eval
  0.04   904.44      0.39     1298     0.30     0.30  Hash#[]=
  0.04   904.81      0.38        6    62.67   476.50  Kernel.require
  0.04   905.17      0.36      179     1.99     2.42  EmptyElementTag#initialize

  0.03   905.44      0.27     1192     0.22     0.22  String#downcase!
  0.01   905.56      0.13       14     8.93    10.07  Module#attr_accessor
  0.01   905.69      0.12      308     0.41     0.41  Module#method_added
  0.01   905.74      0.05       28     1.71     2.25  Module#define_method
  0.01   905.78      0.05       68     0.69     0.69  Comment#initialize
  0.00   905.81      0.03      110     0.28     0.28  Fixnum#+
  0.00   905.83      0.02        1    15.00    15.00  Module#attr
  0.00   905.83      0.00        1     0.00     0.00  File#initialize
  0.00   905.83      0.00        1     0.00     0.00  Declaration#initialize
  0.00   905.83      0.00        1     0.00     0.00  Regexp#quote
  0.00   905.83      0.00        1     0.00     0.00  String#+
  0.00   905.83      0.00        1     0.00     0.00  Array#|
  0.00   905.83      0.00        1     0.00     0.00  Class#initialize
  0.00   905.83      0.00       28     0.00     0.00  String#sub
  0.00   905.83      0.00        4     0.00     0.00  Module#private
  0.00   905.83      0.00       11     0.00     0.00  Module#module_function
  0.00   905.83      0.00        1     0.00     0.00  String#<=>
  0.00   905.83      0.00        1     0.00 904297.00  HTMLSplit#initialize
  0.00   905.83      0.00        1     0.00   765.00  Object#DelegateClass
  0.00   905.83      0.00       15     0.00     0.00  Class#inherited
  0.00   905.83      0.00        1     0.00     0.00  Comparable.<
  0.00   905.83      0.00       25     0.00     0.00  Kernel.singleton_method_ad
ded
  0.00   905.83      0.00        1     0.00     0.00  Kernel.open
  0.00   905.83      0.00        1     0.00     0.00  IO#read
  0.00   905.83      0.00        2     0.00     0.00  Module#public_instance_met
hods
  0.00   905.83      0.00        1     0.00     0.00  Regexp#match
  0.00   905.83      0.00        1     0.00     0.00  Array#-
  0.00   905.83      0.00        1     0.00     0.00  Module#attr_reader
  0.00   905.83      0.00        1     0.00 905828.00  #toplevel


-- 
(有)ナセ工企
 青木 茂
mailto:shig.aok@gmail.com

In This Thread

Prev Next