#1749: readall method on open FileHandle is inefficient
----------------------+-----------------------------------------------------
 Reporter:  pmichaud  |       Owner:       
     Type:  bug       |      Status:  new  
 Priority:  normal    |   Milestone:       
Component:  core      |     Version:  2.6.0
 Severity:  medium    |    Keywords:       
     Lang:            |       Patch:       
 Platform:            |  
----------------------+-----------------------------------------------------
 Using readall on an open filehandle appears to be extremely inefficient.
 Some simple tests reading a 10,000 line file
 can end up taking several seconds to complete.  Notably, reading the
 filehandle line-at-a-time via 'read' is far more efficient than 'readall'.

 Looking at the filehandle.pmc code, it appears that 'readall'
 turns on line buffering on the input filehandle, and then does
 successive string concatenations to produce the resulting string.
 That involves a lot of string allocations, iiuc, which is probably part of
 the slowness.

 I'm not sure why it chooses to use line buffering -- it seems like
 some other strategy would be far more efficient.

 Pm

-- 
Ticket URL: <https://trac.parrot.org/parrot/ticket/1749>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets

Reply via email to