LoginSignup
9
9

More than 5 years have passed since last update.

Zsh でプロファイルをとる

Posted at

zsh/zprof というモジュールが使える。

zsh のモジュールは zmodload $module で読みこむ。

zmodload zsh/zprof

zprof でプロファイルを出力する。

zprof

# num  calls                time                       self            name

# -----------------------------------------------------------------------------------

#  1)    1        1421.46  1421.46   98.57%   1421.46  1421.46   98.57%  update_prompt

#  2)   30           3.45     0.12    0.24%      3.45     0.12    0.24%  url-quote-magic

#  3)    2           3.79     1.90    0.26%      3.24     1.62    0.22%  _all_labels

#  4)   18           4.69     0.26    0.33%      3.18     0.18    0.22%  _description

#  5)   19           2.43     0.13    0.17%      2.43     0.13    0.17%  _setup

#  6)    1          16.38    16.38    1.14%      1.82     1.82    0.13%  _main_complete

#  7)    1          12.74    12.74    0.88%      1.71     1.71    0.12%  _alternative

#  8)   16           2.68     0.17    0.19%      0.73     0.05    0.05%  _next_label

#  9)    1           1.41     1.41    0.10%      0.72     0.72    0.05%  _parameters

# 10)    8           0.61     0.08    0.04%      0.61     0.08    0.04%  _tags

# 11)    1          16.82    16.82    1.17%      0.37     0.37    0.03%  magic-abbrev-expand-and-normal-complete

# 12)    1          13.50    13.50    0.94%      0.30     0.30    0.02%  _complete

# 13)    8           0.28     0.04    0.02%      0.28     0.04    0.02%  _requested

# 14)    2           3.85     1.92    0.27%      0.26     0.13    0.02%  _path_commands

# 15)    2           4.27     2.14    0.30%      0.25     0.13    0.02%  _wanted

# 16)    3           0.24     0.08    0.02%      0.24     0.08    0.02%  magic-abbrev-expand

# 17)    1          12.91    12.91    0.89%      0.16     0.16    0.01%  _command_names

# 18)    1           0.16     0.16    0.01%      0.16     0.16    0.01%  _jobs

# 19)    1          13.12    13.12    0.91%      0.15     0.15    0.01%  _normal

# 20)    1           0.15     0.15    0.01%      0.15     0.15    0.01%  _oldlist

# 21)    1           0.09     0.09    0.01%      0.09     0.09    0.01%  update_window_title

# 22)    1           0.52     0.52    0.04%      0.09     0.09    0.01%  magic-space

# 23)    1           0.08     0.08    0.01%      0.08     0.08    0.01%  _suffix_alias_files

# 24)    1           0.07     0.07    0.01%      0.07     0.07    0.01%  _first

# 25)    1          12.98    12.98    0.90%      0.07     0.07    0.01%  _autocd

# 26)    1           0.11     0.11    0.01%      0.04     0.04    0.00%  magic-abbrev-expand-and-accept

# 

# -----------------------------------------------------------------------------------

# 

#  1)    1        1421.46  1421.46   98.57%   1421.46  1421.46   98.57%  update_prompt

# 

# -----------------------------------------------------------------------------------

# 

# 11)    1          16.82    16.82    1.17%      0.37     0.37    0.03%  magic-abbrev-expand-and-normal-complete

#        1/3         0.08     0.08    0.01%      0.08     0.08             magic-abbrev-expand [16]

#        1/1        16.38    16.38    1.14%      1.82     1.82             _main_complete [6]

# 

# -----------------------------------------------------------------------------------

# 

#        1/1        16.38    16.38    1.14%      1.82     1.82             magic-abbrev-expand-and-normal-complete [11]

#  6)    1          16.38    16.38    1.14%      1.82     1.82    0.13%  _main_complete

#        1/1         0.15     0.15    0.01%      0.15     0.15             _oldlist [20]

#        1/19        0.92     0.92    0.06%      0.92     0.92             _setup [5]

#        1/1        13.50    13.50    0.94%      0.30     0.30             _complete [12]

# 

# -----------------------------------------------------------------------------------

# 

#        1/1        13.50    13.50    0.94%      0.30     0.30             _main_complete [6]

# 12)    1          13.50    13.50    0.94%      0.30     0.30    0.02%  _complete

#        1/1         0.07     0.07    0.01%      0.07     0.07             _first [24]

#        1/1        13.12    13.12    0.91%      0.15     0.15             _normal [19]

# 

# -----------------------------------------------------------------------------------

# 

#        1/1        13.12    13.12    0.91%      0.15     0.15             _complete [12]

# 19)    1          13.12    13.12    0.91%      0.15     0.15    0.01%  _normal

#        1/1        12.98    12.98    0.90%      0.07     0.07             _autocd [25]

# 

# -----------------------------------------------------------------------------------

# 

#        1/1        12.98    12.98    0.90%      0.07     0.07             _normal [19]

# 25)    1          12.98    12.98    0.90%      0.07     0.07    0.01%  _autocd

#        1/1        12.91    12.91    0.89%      0.16     0.16             _command_names [17]

# 

# -----------------------------------------------------------------------------------

# 

#        1/1        12.91    12.91    0.89%      0.16     0.16             _autocd [25]

# 17)    1          12.91    12.91    0.89%      0.16     0.16    0.01%  _command_names

#        1/1        12.74    12.74    0.88%      1.71     1.71             _alternative [7]

# 

# -----------------------------------------------------------------------------------

# 

#        1/1        12.74    12.74    0.88%      1.71     1.71             _command_names [17]

#  7)    1          12.74    12.74    0.88%      1.71     1.71    0.12%  _alternative

#        1/1         0.08     0.08    0.01%      0.08     0.08             _suffix_alias_files [23]

#        1/1         0.16     0.16    0.01%      0.16     0.16             _jobs [18]

#        8/8         0.28     0.04    0.02%      0.28     0.04             _requested [13]

#        2/8         0.39     0.19    0.03%      0.39     0.19             _tags [10]

#        1/1         1.41     1.41    0.10%      0.72     0.72             _parameters [9]

#        8/18        2.19     0.27    0.15%      1.52     0.19             _description [4]

#       16/16        2.68     0.17    0.19%      0.73     0.05             _next_label [8]

#        1/2         3.85     3.85    0.27%      0.22     0.22             _path_commands [14]

# 

# -----------------------------------------------------------------------------------

# 

#        8/18        2.19     0.27    0.15%      1.52     0.19             _alternative [7]

#        8/18        1.95     0.24    0.14%      1.30     0.16             _next_label [8]

#        2/18        0.55     0.28    0.04%      0.36     0.18             _all_labels [3]

#  4)   18           4.69     0.26    0.33%      3.18     0.18    0.22%  _description

#       18/19        1.51     0.08    0.10%      1.51     0.08             _setup [5]

# 

# -----------------------------------------------------------------------------------

# 

#        1/2         3.58     3.58    0.25%      0.12     0.12             _path_commands [14]

#        1/2         0.69     0.69    0.05%      0.13     0.13             _parameters [9]

# 15)    2           4.27     2.14    0.30%      0.25     0.13    0.02%  _wanted

#        6/8         0.23     0.04    0.02%      0.23     0.04             _tags [10]

#        2/2         3.79     1.90    0.26%      3.24     1.62             _all_labels [3]

# 

# -----------------------------------------------------------------------------------

# 

#        1/2         3.85     3.85    0.27%      0.22     0.22             _alternative [7]

#        1/2         3.62     3.62    0.25%      0.04     0.04             _path_commands [14]

# 14)    2           3.85     1.92    0.27%      0.26     0.13    0.02%  _path_commands

#        1/2         3.58     3.58    0.25%      0.12     0.12             _wanted [15]

#        1/2         3.62     3.62    0.25%      0.04     0.04             _path_commands [14]

# 

# -----------------------------------------------------------------------------------

# 

#        2/2         3.79     1.90    0.26%      3.24     1.62             _wanted [15]

#  3)    2           3.79     1.90    0.26%      3.24     1.62    0.22%  _all_labels

#        2/18        0.55     0.28    0.04%      0.36     0.18             _description [4]

# 

# -----------------------------------------------------------------------------------

# 

#        1/30        0.34     0.34    0.02%      0.34     0.34             magic-space [22]

#  2)   30           3.45     0.12    0.24%      3.45     0.12    0.24%  url-quote-magic

# 

# -----------------------------------------------------------------------------------

# 

#       16/16        2.68     0.17    0.19%      0.73     0.05             _alternative [7]

#  8)   16           2.68     0.17    0.19%      0.73     0.05    0.05%  _next_label

#        8/18        1.95     0.24    0.14%      1.30     0.16             _description [4]

# 

# -----------------------------------------------------------------------------------

# 

#       18/19        1.51     0.08    0.10%      1.51     0.08             _description [4]

#        1/19        0.92     0.92    0.06%      0.92     0.92             _main_complete [6]

#  5)   19           2.43     0.13    0.17%      2.43     0.13    0.17%  _setup

# 

# -----------------------------------------------------------------------------------

# 

#        1/1         1.41     1.41    0.10%      0.72     0.72             _alternative [7]

#  9)    1           1.41     1.41    0.10%      0.72     0.72    0.05%  _parameters

#        1/2         0.69     0.69    0.05%      0.13     0.13             _wanted [15]

# 

# -----------------------------------------------------------------------------------

# 

#        2/8         0.39     0.19    0.03%      0.39     0.19             _alternative [7]

#        6/8         0.23     0.04    0.02%      0.23     0.04             _wanted [15]

# 10)    8           0.61     0.08    0.04%      0.61     0.08    0.04%  _tags

# 

# -----------------------------------------------------------------------------------

# 

# 22)    1           0.52     0.52    0.04%      0.09     0.09    0.01%  magic-space

#        1/3         0.09     0.09    0.01%      0.09     0.09             magic-abbrev-expand [16]

#        1/30        0.34     0.34    0.02%      0.34     0.34             url-quote-magic [2]

# 

# -----------------------------------------------------------------------------------

# 

#        8/8         0.28     0.04    0.02%      0.28     0.04             _alternative [7]

# 13)    8           0.28     0.04    0.02%      0.28     0.04    0.02%  _requested

# 

# -----------------------------------------------------------------------------------

# 

#        1/3         0.09     0.09    0.01%      0.09     0.09             magic-space [22]

#        1/3         0.08     0.08    0.01%      0.08     0.08             magic-abbrev-expand-and-normal-complete [11]

#        1/3         0.07     0.07    0.00%      0.07     0.07             magic-abbrev-expand-and-accept [26]

# 16)    3           0.24     0.08    0.02%      0.24     0.08    0.02%  magic-abbrev-expand

# 

# -----------------------------------------------------------------------------------

# 

#        1/1         0.16     0.16    0.01%      0.16     0.16             _alternative [7]

# 18)    1           0.16     0.16    0.01%      0.16     0.16    0.01%  _jobs

# 

# -----------------------------------------------------------------------------------

# 

#        1/1         0.15     0.15    0.01%      0.15     0.15             _main_complete [6]

# 20)    1           0.15     0.15    0.01%      0.15     0.15    0.01%  _oldlist

# 

# -----------------------------------------------------------------------------------

# 

# 26)    1           0.11     0.11    0.01%      0.04     0.04    0.00%  magic-abbrev-expand-and-accept

#        1/3         0.07     0.07    0.00%      0.07     0.07             magic-abbrev-expand [16]

# 

# -----------------------------------------------------------------------------------

# 

# 21)    1           0.09     0.09    0.01%      0.09     0.09    0.01%  update_window_title

# 

# -----------------------------------------------------------------------------------

# 

#        1/1         0.08     0.08    0.01%      0.08     0.08             _alternative [7]

# 23)    1           0.08     0.08    0.01%      0.08     0.08    0.01%  _suffix_alias_files

# 

# -----------------------------------------------------------------------------------

# 

#        1/1         0.07     0.07    0.01%      0.07     0.07             _complete [12]

# 24)    1           0.07     0.07    0.01%      0.07     0.07    0.01%  _first

update_prompt という関数がめちゃめちゃ遅いということがわかる。

9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9