To give you a general idea:
#!/usr/bin/perl -w use strict; use Time::HiRes qw/gettimeofday tv_interval/; my(@data, %seen); $data[$_] = int rand 100 for 0 .. 1e6 - 1; # 1,000,000 pieces of data my $t0 = [gettimeofday]; for (@data){ 1 unless $seen{$_}++; # Perform a no-op the first time we see a +given number } print "Elapsed time: ", tv_interval($t0, [gettimeofday]), " seconds\n" +;
Running this 1 million-item data list with a hash lookup for each item on my little laptop (Intel Atom 1.6GHz) gives the following:
Elapsed time: 1.466658 seconds
Reasonably fast, I'd say.
-- Education is not the filling of a pail, but the lighting of a fire. -- W. B. Yeats
In reply to Re: need for speed - how fast is a hash
by oko1
in thread need for speed - how fast is a hash
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |