in reply to The Upper Limit of Perl's Native Data Structures

Theory:

A hash in perl uses at least 32 bits for the bucket index, so that would translate to 2Gig buckets, so a perfectly filled hash could contain 2Gig elements (if not perfectly filled, it could be a lot more or a lot less). Also, depending on your machine, it could use more bits for the index.

Practice:

This code:
#!/usr/bin/perl -w use strict; $|=1; my @nodes; for (1 .. 3000) { push @nodes,{ number => $_ }; print "\r$_" unless $_ % 1000; } my @edges; for (0 .. 2500000) { push @edges,{ s => \ $nodes[$_ % 3000], d => \ $nodes[3000 - $_ % +3000] }; print "\r$_" unless $_ % 1000; } print "\ndone, press enter to exit"; my $dummy = <STDIN>;
Eats up about 430 Mb on my machine: perl v5.8.0 built for i386-linux-thread-multi.

It's not super-fast, but it still works. However, how much memory Graph::Directed objects will take, and how long operations on the graphs will take is something you'll have to test for yourself.

Joost.

-- #!/usr/bin/perl -np BEGIN{@ARGV=$0}s(^([^=].*)|=)()s; =Just another perl hacker\