Skip to content

codeintel: Reduce allocations in serializer

Administrator requested to merge worker-allocations into master

Created by: efritz

This was an attempt to reduce the number of allocations in the worker, which it turns out are all situated inside of the serializer before writing to a SQLite file.

This refactors the defaultSerializer into a new JSON serializer package (we will probably be choosing another serialization format in the near future). The only differences is that instead of serializing map[string]interface{}, we create a named struct and serialize a value type. This allows us to stack allocate most of the stuff we pass to json.Marshal, where maps would need to be heap allocated regardless of their escape properties.

Running the precise-code-intel integration suite's upload phase on master:

3m37.597s
3m35.858s
3m42.591s

And after this change:

3m23.639s
3m13.413s
3m17.683s

Merge request reports

Loading