use Math::Complex;

It doesn't look like this module is used anywhere.    Is it actually needed?



use Win32; ... "generation $generation_counter time: " . Win32::GetTickCount +. " \n" );

Perhaps you could use Time::HiRes and make your code more portable.



my $gene_length = gene_length(); ... if ( defined( $genome{$gene} ) ) { push( @phenotype, $genome{$gene} ); ... sub gene_length { my @gls = (); foreach my $key ( keys(%genome) ) { push( @gls, length($key) ); } @gls = sort(@gls); if ( $gls[0] != $gls[$#gls] ) { die("Invalid genotype"); } return ( $gls[0] ); }

You never modify the %genome hash and the keys are always the same size so you don't really need the gene_length subroutine.

If you wanted to you could just do:

my $gene_length = length +( keys %genome )[ 0 ];


Some of the places where you use arrays could be made more efficient by using strings instead.


In reply to Re: Perl slower than java by jwkrahn
in thread Perl slower than java by Christian888

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.