eclipse-cdt-cloud / cdt-gdb-adapter

CDT GDB Debug Adapter
Eclipse Public License 2.0
28 stars 40 forks source link

Improve parser regex performance #202

Closed colin-grant-work closed 2 years ago

colin-grant-work commented 2 years ago

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:

eclipse-cdt-bot commented 2 years ago

Can one of the admins verify this patch?

jonahgraham commented 2 years ago

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.

colin-grant-work commented 2 years ago

Thanks, @jonahgraham!