bufbuild / protocompile

A parsing/linking engine for protobuf; the guts for a pure Go replacement of protoc.
Apache License 2.0
227 stars 18 forks source link

Add test case for latest fuzzer timeout issue and fix the pathological performance #343

Closed jhump closed 1 week ago

jhump commented 1 week ago

The pathological test case was taking ~10 seconds (!!). Now it's just 200ms.

The issue was that it was relying on ast.FileInfo to provide things like the line numbers for tokens. But those are all computed on-demand. And this operation was being done enough that it induced pathological bad performance.

So now we have just a little bit more book-keeping in the lexer so that we can decide when to donate a comment to prior token as a trailing comment without having to ask the file info to compute things.