CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [FishMonger] iterate over millions hash entries: Edit Log



skualito92
New User

Apr 12, 2017, 7:12 AM


Views: 7420
Re: [FishMonger] iterate over millions hash entries


In Reply To
Use a database?

We can't really answer that question without seeing your code and sample data.

The only suggestion I can make at this point is for you to profile your script to see where it's spending it's time and then focus on optimizing the slow parts, which may or may not be the section where you think the problem is located.

Devel::NYTProf - Powerful fast feature-rich Perl source code profiler
https://metacpan.org/pod/Devel::NYTProf


my code is a simple key,value hash.
keys are strings and values are numbers.
then i sort keys by the value number.

example:

%hash = (
'foo' => 10,
'bar' => 30,
)

it just take lots of time because i have millions of keys, you think using a DB will be more efficient ? i will give a try with sqlite...

i already profiled the code and it show that it spend all his time in the loop over the hash.


(This post was edited by skualito92 on Apr 12, 2017, 7:13 AM)


Edit Log:
Post edited by skualito92 (New User) on Apr 12, 2017, 7:13 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives