Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Benchmarking Simple Perl program vs. Java equivalent

by Krambambuli (Curate)
on Jun 19, 2010 at 11:25 UTC ( #845527=note: print w/replies, xml ) Need Help??


in reply to Benchmarking Simple Perl program vs. Java equivalent

I'm too much of a Java-ignorant to be able to pinpoint the 'real' differences here, but it seems to me that the Java-hashlike construct you're using is quite a different beast than Perl's hashes.

Whereas in Perl you have real arrays of real hashes, and the hashes deep down there _do have_ _stored_ keys _and_ stored values, I somewhat miss the hash keys in the Java code - but I might be wrong.

Obviously, if the basic underlying data structures used in Perl are indeed much more sophisticated/complicated than what's there for it in Java - despite their 'almost alikeness' - the processing time will reflect this difference between the structures used.

Update By rewriting the core of your Perl code as
if ( $gene_to < $gene_from ) { # split # low range first $temp_gene_to_legal_range = [ # { FROM => 0, TO => $ge +ne_to }, # { # FROM => $gene_ +from, # TO => $zone_ +o->{_chromosome_length} # } 0, $gene_to, $gene_from, $zo +ne_o->{_chromosome_length} ]; } else { # single $temp_gene_to_legal_range = # [ { FROM => $gene_from, TO +=> $gene_to } ]; [ $gene_from, $gene_to ] }
the time displayed goes down on my machine from approx. 14.5 to 11.4. Might be that that's another path to follow.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://845527]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2017-10-22 07:25 GMTServer Error (Error ID 8359050c38790)

An error has occurred. The site administrators have been notified of the problem and will likely soon fix it. We thank you, for you're patients.

Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (272 votes). Check out past polls.

    Notices?