I have been tasked with converting an old VB6 program to perl. I have now completed it, and it is working fine (read as - the output is correct). My problem is that it is taking multiple times longer to run in PERL than the original was in VB6. Upon eyeing the process, I notice that it is only using an average of 3 - 4% of CPU while running.
Is there any way to force PERL to run faster by using more CPU time? The issue can be seen in this profiler output:
BerkeleyDB::AUTOLOAD has -1 unstacked calls in outer BerkeleyDB::__ANON__ has 1 unstacked calls in outer Total Elapsed Time = 261.6975 Seconds User+System Time = 14.43755 Seconds Exclusive Times %Time ExclSec CumulS #Calls sec/call Csec/c Name 46.1 6.667 6.667 124415 0.0001 0.0001 BerkeleyDB::Common::db_ge 41.0 5.924 15.515 1 5.9238 15.515 main::ProcessLog 15.0 2.167 8.834 124415 0.0000 0.0001 BerkeleyDB::_tiedHash::FE +TCH 3.89 0.561 0.561 22983 0.0000 0.0000 BerkeleyDB::Common::db_pu +t 1.36 0.197 0.757 22983 0.0000 0.0000 BerkeleyDB::_tiedHash::ST +ORE 0.11 0.016 0.016 3 0.0053 0.0053 vars::BEGIN 0.11 0.016 0.016 1 0.0160 0.0160 XSLoader::load 0.10 0.015 0.015 1 0.0150 0.0150 BerkeleyDB::Term::close_e +verything 0.10 0.015 0.015 5 0.0030 0.0030 BerkeleyDB::Hash::_db_ope +n_hash 0.00 - -0.000 1 - - DynaLoader::dl_load_file 0.00 - -0.000 1 - - DynaLoader::dl_undef_symb +ols 0.00 - -0.000 1 - - DynaLoader::dl_find_symbo +ls 0.00 - -0.000 1 - - DynaLoader::dl_install_xs +ub 0.00 - -0.000 1 - - BerkeleyDB::bootstrap 0.00 - -0.000 1 - - BerkeleyDB::constant
The main thing there being that only 14 cpu seconds out of 261 seconds of real run time is being used. This was done on a file significantly smaller than production, so I'm sure any of you can see how expensive this begins to become on time.
Any help on getting this moving at a more appropriate pace would be greatly appreciated. I am thinking about dividing the input file into multiple files and running multiple threads to speed this up, but would like to see some potential alternatives first.
Thanks!
In reply to Increasing CPU Usage/Decreasing Run Time by NathanE
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |