Permalink
Browse files

Uggh; horrible inner loop screwing up all performance :-(

This might actually make the redis version unnecessary for most people!
And if it does, well shame on me for not instrumenting things at a more
granular level before going all "oh we need a cache!"

[In my defense, I blame redis for being such a sweet little tool that I
felt compelled to use it somehow!]

----

t/sequence failed because the test itself was in error; fixed.
  • Loading branch information...
1 parent 1f96180 commit d3d93961a082c286d3f205d310c78079ebc3256f @sitaramc committed Nov 14, 2012
Showing with 19 additions and 4 deletions.
  1. +5 −2 src/lib/Gitolite/Conf/Load.pm
  2. +12 −0 src/lib/Gitolite/Conf/Store.pm
  3. +1 −1 src/lib/Gitolite/Rc.pm
  4. +1 −1 t/sequence.t
@@ -32,6 +32,7 @@ our $data_version = '';
our %repos;
our %one_repo;
our %groups;
+our %patterns;
our %configs;
our %one_config;
our %split_conf;
@@ -326,8 +327,10 @@ sub memberships {
}
}
- for my $i ( keys %groups ) {
- if ( $base eq $i or $base =~ /^$i$/ or $base2 and ( $base2 eq $i or $base2 =~ /^$i$/ ) ) {
+ push @ret, @{ $groups{$base} } if exists $groups{$base};
+ push @ret, @{ $groups{$base2} } if $base2 and exists $groups{$base2};
+ for my $i ( keys %{ $patterns{groups} } ) {
+ if ( $base =~ /^$i$/ or $base2 and ( $base2 =~ /^$i$/ ) ) {
push @ret, @{ $groups{$i} };
}
}
@@ -288,6 +288,8 @@ sub store_common {
my $cc = "conf/gitolite.conf-compiled.pm";
my $compiled_fh = _open( ">", "$cc.new" );
+ my %patterns = ();
+
my $data_version = glrc('current-data-version');
trace( 3, "data_version = $data_version" );
print $compiled_fh Data::Dumper->Dump( [$data_version], [qw(*data_version)] );
@@ -301,7 +303,17 @@ sub store_common {
my %groups = %{ inside_out( \%groups ) };
$dumped_data = Data::Dumper->Dump( [ \%groups ], [qw(*groups)] );
print $compiled_fh $dumped_data;
+
+ # save patterns in %groups for faster handling of multiple repos, such
+ # as happens in the various POST_COMPILE scripts
+ for my $k (keys %groups) {
+ $patterns{groups}{$k} = 1 unless $k =~ $REPONAME_PATT;
+ }
}
+
+ $dumped_data = Data::Dumper->Dump( [ \%patterns ], [qw(*patterns)] ) if %patterns;
+ print $compiled_fh $dumped_data;
+
print $compiled_fh Data::Dumper->Dump( [ \%split_conf ], [qw(*split_conf)] ) if %split_conf;
close $compiled_fh or _die "close compiled-conf failed: $!\n";
View
@@ -58,7 +58,7 @@ $UNSAFE_PATT = qr([`~#\$\&()|;<>]);
# find the rc file and 'do' it
# ----------------------------------------------------------------------
-my $current_data_version = "3.0";
+my $current_data_version = "3.2";
my $rc = glrc('filename');
if (-r $rc and -s $rc) {
View
@@ -55,7 +55,7 @@ try "
confreset;confadd '
@staff = u1 u2 u3
- @gfoo = foo/CREATOR/.+
+ @gfoo = foo/CREATOR/..*
repo @gfoo
C = u1
RW+ = CREATOR

0 comments on commit d3d9396

Please sign in to comment.