Use devel: nytprof to optimize Perl script Performance

Source: Internet
Author: User
Tags perl script

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/
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.