Sending a script a few days ago is very slow. Using Time can only know the total time, but cannot confirm the reason. We found that devel: nytprof is a very good tool.
If you have the root permission, then:
Perl-mcpan-e Shell
> Installjson: Any)
> Installdevel: nytprof
If you do not have the root permission, then:
- Create a folder in the home directory, such as/home/username/perl. Local.
- From http://search.cpan.org /~ Timb/Devel-NYTProf-4.06/lib/devel/nytprof. PM download the original file to this folder
- Decompress and make
- Find the prefix in makefile and change the value to/home/username/perl. Local.
- Create a local directory under/home/username/perl. Local
- Then make install to complete the installation.
- /Home/username/perl. Local contains bin, local, and share directories.
- Modify the environment variable, export perl5lib = "$ perl5lib:/home/username/perl. Local/local/lib/perl/5.8.4"
Run Perl-D: nytprof/home/username/url_parser.pl to generate nytprof. Out in the current path.
Run/home/username/perl. Local/bin/nytprofhtml nytprof. Out to generate a Web page.
Look at the function's most time-consuming
Check that the statement is the most time-consuming.
[Reference]
- Http://blog.sina.com.cn/s/blog_04268f4b0100moi9.html
- Http://augustinalareina.wordpress.com/2011/02/05/getting-started-with-develnytprof/