Permalink
Browse files

Item14066: fixed performance of getTopicNames

  • Loading branch information...
1 parent 22e2500 commit 2855ba789133dab56f3d7f0bb83e7b7406676a01 MichaelDaum committed May 10, 2016
Showing with 5 additions and 1 deletion.
  1. +5 −1 RCSStoreContrib/lib/Foswiki/Store/Rcs/Handler.pm
@@ -35,6 +35,7 @@ use File::Copy ();
use File::Copy::Recursive ();
use File::Spec ();
use File::Path ();
+use Unicode::Normalize;
use Fcntl qw( :DEFAULT :flock SEEK_SET );
use Encode ();
@@ -583,12 +584,15 @@ sub getTopicNames {
# the name filter is used to ensure we don't return filenames
# that contain illegal characters as topic names.
my @topicList =
+ map { $_->[0] }
+ sort { $a->[1] cmp $b->[1] }
+ map { [ $_, NFKD($_) ] }
map { /^(.*)\.txt$/; $1; }
- sort { NFKD($a) cmp NFKD($b) } # unicode aware
grep { !/$Foswiki::cfg{NameFilter}/ && /\.txt$/ }
# Must _decode before applying the NameFilter and sort
map( _decode($_), readdir($dh) );
+
closedir($dh);
return @topicList;
}

0 comments on commit 2855ba7

Please sign in to comment.