Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

would it be worth it to use inline::C to speed up math

i have been working on a perl program to process large amounts of dna. It outputs exactly what i need however it takes much longer than i would like using NYTprof i have narrowed down the major problem areas to be the loop that adds my values together. would using inline::C to do the math make my program faster or should i accept the speed and move on? is there another way to improve the speed? here is my program and an input it would run as well as an executable with the default values entered already.

like image 645
Orion Avatar asked Oct 24 '22 06:10

Orion


1 Answers

It's unlikely you'll get useful help here (this included). I can see various problems with your code, and none have to do with the choice of language.

  1. use CPAN. If you're parsing genbank, then use some an appropriate module.

  2. You're writing assembly in Perl, and neither Perl nor you are very good at that. It's near impossible to know what's going on when you don't pass parameters to subroutines, instead relying on globals all over the place. What do @X1, @X2, @Y1, @Y2 mean?

  3. The following might be your problem: until ($ender - $starter > $tlength) { (line 153). According to your test case, these start by being 103, 1, and 200, and it's not clear when or if they change. Depending on what's in @te, it might or might not ever get out of the loop; I just can't tell from your code.

  4. It would help if we knew, exactly, what are the parameters to add, the in-out invariants, and what it is returning.

That's all I got.

like image 107
Pedro Silva Avatar answered Oct 27 '22 11:10

Pedro Silva