[Bps-public-commit] r14974 - Prophet/trunk/lib/Prophet/Replica

jesse at bestpractical.com jesse at bestpractical.com
Sun Aug 10 02:44:20 EDT 2008


Author: jesse
Date: Sun Aug 10 02:44:19 2008
New Revision: 14974

Modified:
   Prophet/trunk/lib/Prophet/Replica/Native.pm

Log:
* switching to our own slurop gives an apparent 10% perf bonus on ticket list

Modified: Prophet/trunk/lib/Prophet/Replica/Native.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Replica/Native.pm	(original)
+++ Prophet/trunk/lib/Prophet/Replica/Native.pm	Sun Aug 10 02:44:19 2008
@@ -660,7 +660,7 @@
     my $self = shift;
     my ($file) = validate_pos( @_, 1 );
     if ( $self->fs_root ) {
-        return eval { scalar file( $self->fs_root => $file )->slurp };
+        return eval { $self->_slurp (file( $self->fs_root => $file )) };
     } else {    # http replica
         return LWP::Simple::get( $self->url . "/" . $file );
     }
@@ -668,6 +668,15 @@
 
 }
 
+sub _slurp {
+    my $self = shift;
+    my $abspath = shift;
+    open (my $fh, "<", "$abspath") || die $!;
+    my @lines = <$fh>;
+    close $fh;
+    return join('', at lines);
+
+}
 
 sub begin_edit {
     my $self = shift;



More information about the Bps-public-commit mailing list