-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
I was wondering why running kustomize (& kpt) is not effectively instant, and I tracked down a large performance bottleneck - initializing the OpenAPI / parsing the swagger.
I believe this is the most significant constant-overhead for kustomize - obviously on very large kustomizations the data manipulation will eventually dominate.
I sent #3669 which adds a benchmark to quantify the impact; based on that it takes about 900ms to json parse the swagger itself; it takes about 20ms to un-gzip from the data embedded into the binary. These roughly tally with the performance overhead I see in the real world.
This particularly matters for e.g. kpt, where a kpt setter which uses kyaml also takes at least 1 second to run.
I think it would be interesting to cache the deserialized form.
But there's also some low-hanging fruit, e.g. the swagger UnmarshalJSON code calls json.Unmarshal twice over the same data (once for SwaggerProps, once for VendorExtensible). But that only gets us 2x, whereas caching (I'd SWAG) could be 100-1000x.