Closed howardjohn closed 3 years ago
By the way, the time to start the binary does matter, as we run the binary 1000s of times to detect test flakes. So when the init time accounts for ~250ms, it really slows down the tests
@howardjohn on recent versions, I've removed the need to load these assets in init() and this is now initialized lazily when first calling expansion. If you are not using Expand, no heavy init() should be performed, and no memory allocated for the static assets.
Fantastic! I don't know how I missed that originally, sorry for the noise
Just starting a test binary, compiled with
-race
, which depends on this library:Modifying the library so that MustLoadJSONSchemaDraft04 and MustLoadSwagger20Schema do nothing:
You can see its almost 2x faster
Currently the library is embedding a json string from go:generate. Maybe it would be more efficient to generate the go struct directly?