So make the code you benchmark as close as possible to what you will actually use in production. Make sure the machine is not heavily loaded, because a really busy machine could spend so much time keeping its house in order that it would skew the CPU figure. Therefore, make benchmarks short enough that you can keep an eye on the system with top or the equivalent while they’re running, and so you can run them again to ensure that the results are consistent. 11.2.3 Ask de Prof Our discussion of Benchmark presumes that you know where the critical regions of your code are. After all, if you have a subroutine that consumes only 1% of the time used by your program, no amount of optimization therein will improve your overall performance by more than 1%. One way of finding out where your program spends the most time is with the Devel::DProfmodule. To see it in action, we’ll construct a very simple program to count different types of file on our system: use strict; my ($symlinks, $dirs, $regulars, $sockets, $blocks, $chars, $others) = (0) x 7; doit (’/'); print <<"EOF"; Symlinks: $symlinks, Dirs: $dirs, Regulars: $regulars Sockets: $sockets, Blocks: $blocks, Chars: $chars, Others: $others EOF sub doit { my $dir = shift; opendir DIR, $dir or return; my @files = grep !/^..?$/, readdir DIR; closedir DIR; $dir = '' if $dir eq '/'; process("$dir/$_") for @files; doit($_) for grep ! -l, grep -d, map "$dir/$_", @files; } sub process { local $_ = shift; -l && return sym($_); -d && return dir($_); -f && return regular($_); -S && return sock($_); -b && return block($_); -c && return char($_); return other($_); }
Note: If you are looking for good and high quality web space to host and run your java application check Vision java hosting services