Changeset 24449

Show
Ignore:
Timestamp:
23.08.2011 14:06:33 (8 years ago)
Author:
ak19
Message:

John Thompson improvement to file reading: faster, more efficient way of reading than traditional slurping in of the file (one newline at a time). Will be tested.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/ReadTextFile.pm

    r23484 r24449  
    216216      
    217217    if ($encoding eq "ascii") { 
    218     undef $/; 
    219     $$textref = <FILE>; 
    220     $/ = "\n"; 
     218    # Replace file 'slurp' with faster implementation 
     219    sysread(FILE, $$textref, -s FILE); 
     220     
     221    # The old slow way of reading in a file 
     222    #undef $/; 
     223    #$$textref = <FILE>; 
     224    #$/ = "\n"; 
    221225    } else { 
    222226    my $reader = new multiread();