Created
July 7, 2015 15:42
-
-
Save bigpresh/d1d3589821279a46f552 to your computer and use it in GitHub Desktop.
20k hashes memory usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[davidp@supernova:~]$ cat tmp/hashes.pl | |
#!/usr/bin/perl | |
# | |
use Memory::Usage; | |
my $mu = Memory::Usage->new(); | |
# Record amount of memory used by current process | |
$mu->record('before creating hashes'); | |
my @hashes; | |
for (1..20_000) { | |
push @hashes, { | |
one => 'Foo', | |
two => rand(100), | |
three => 'Bar', | |
}; | |
} | |
# Record amount in use afterwards | |
$mu->record('after creating hashes'); | |
# Spit out a report | |
$mu->dump(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[davidp@supernova:~]$ perl tmp/hashes.pl | |
time vsz ( diff) rss ( diff) shared ( diff) code ( diff) data ( diff) | |
0 6080 ( 6080) 1980 ( 1980) 1584 ( 1584) 1444 ( 1444) 732 ( 732) before creating hashes | |
0 11056 ( 4976) 6996 ( 5016) 1680 ( 96) 1444 ( 0) 5708 ( 4976) after creating hashes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment