in reply to regex for a socket stream

I think your overstating the probelms here. Even a socket stream isn't continuous. Transmission is in packets, reads are in buffer sized chunks.

Once you have your first buffer load, you can overlap the processing, or at least inspection of that with the next read.

Processing a buffer is just string manipulation which perl excels at. No need for low-level code here.

If when looking at the first buffer load it contains a START but not the complete command, ten you have to wait for the next buffer load anyway. If when you get the next buffer load it contains another START befoe the completion of the previous, you discard the previous.

Tuning responsiveness -v- throughtput comes down to adjusting the read size and making sure that the inspection process takes less time than the read.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algoritm, algorithm on the code side." - tachyon