Closed colin-grant-work closed 2 years ago
Can one of the admins verify this patch?
Its up npm: https://www.npmjs.com/package/cdt-gdb-adapter/v/0.0.16-next.20220908234947.bdf98e3.0
Thanks @colin-grant-work for the performance improvement.
Thanks, @jonahgraham!
If a large message comes in many parts, the current code of the parser is very inefficient: it rechecks the entire buffer, even though when a new chunk arrives, we can guarantee that the regex cannot match the existing buffer, and it uses a capture that will always just capture everything from the beginning of the string to the point of a line break.
This PR addresses both of those deficiencies:
index
field of the result is used to pick the end of the slice sent for parsing.