orthecreedence / cl-async

Asynchronous IO library for Common Lisp.
MIT License
273 stars 40 forks source link

Stream read sequence #136

Closed mtstickney closed 8 years ago

mtstickney commented 8 years ago

At this line in stream-read-sequence, you're doing (subseq buffer start <end>), but start is an index into the output sequence, not an index into the internal stream buffer. This causes problems when trying to fill a large sequence from multiple reads on a tcp connection.

This branch fixes that and cleans the function up a little. There should be a small performance increase, since the new version doesn't cons up an intermediate sequence to copy into the output. You could get more out of it by storing a read cursor in the stream instead of using subseq on the internal buffer, but that's a bit more involved.

Review on Reviewable

orthecreedence commented 8 years ago

Hey thanks for the update, and sorry for the lag (it's been a really crazy month for me).