openllb / hlb

A developer-first language to build and test any software efficiently
https://openllb.github.io/hlb/
Apache License 2.0
108 stars 12 forks source link

Return cached SourceMap in FileBuffer #324

Closed aaronlehmann closed 2 years ago

aaronlehmann commented 2 years ago

openllb/hlb#286 changed FileBuffer to return a newly constructed SourceMap on each call to the SourceMap method. This causes a dramatic increase in the gRPC request size, because It turns out that BuildKit deduplicates source maps based on pointer address: https://github.com/moby/buildkit/blob/d21254e7f74b49a84c3fbe1b13260cb23954cf92/client/llb/sourcemap.go#L57

Reuse the same SourceMap structure when nothing has changed.