It depends a great deal on the data you need and how much of it there actually is. If 'some hundreds' is about 300 then almost any module that can be used for configuration and that suits your data criteria will turn the trick. If you need a lot more than that and your data is simple then a hand rolled solution may be what you need. Consider the following simple benchmark:
use warnings; use strict; use Benchmark qw(timethese cmpthese); use YAML qw(); use XML::Simple qw(); use Config::Fast qw(); my %bigHash = map {$_ => genStr ($_)} genKeys (1 .. 300); YAML::DumpFile ("delme.yaml", \%bigHash); open my $out, '>', "delme.xml" or die "Can't create demle.xml: $!\n"; print $out XML::Simple::XMLout (\%bigHash); close $out; open $out, '>', "delme.fast" or die "Can't create delme.fast: $!\n"; print $out "$_ $bigHash{$_}\n" for keys %bigHash; close $out; my $yamlHash = YAML::LoadFile ("delme.cfg"); my $fastHash = Config::Fast::fastconfig ("delme.fast"); my $xmlHash = XML::Simple::XMLin ("delme.xml"); my $slurpHash = {do {local @ARGV = "delme.fast"; my %newHash = map {sp +lit ' ', $_, 2} <>;}}; cmpthese (-1, { YAML => sub {my $newHash = YAML::LoadFile ("delme.cfg");}, fast => sub {my $newHash = Config::Fast::fastconfig ("delme.fast") +;}, XML => sub {my $newHash = XML::Simple::XMLin ("delme.xml");}, slurp => sub {local @ARGV = "delme.fast"; my %newHash = map {split + ' ', $_, 2} <>;} } ); sub genKeys { my @keys; for my $seed (@_) { push @keys, "x$seed"; } return @keys; } sub genStr { my ($key) = @_; return "Str " . ('x' x (substr ($key, 1) % 100)); }
Prints:
Rate YAML XML fast slurp YAML 21.0/s -- -8% -53% -98% XML 22.8/s 8% -- -50% -98% fast 45.2/s 115% 98% -- -96% slurp 1211/s 5665% 5216% 2583% --
In reply to Re: fastest file processing Config file format
by GrandFather
in thread fastest file processing Config file format
by Davewhite
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |