In general, when putting multiple entities in the datastore, the put operations can be batched together as: `datastore.Put(ctx, entity1, entity2)`.
Context: https://chromium-review.googlesource.com/c/infra/infra/+/1048766/2/go/src/infra/tricium/appengine/frontend/rpc_analyze.go#215
The advantage of batching is possible performance gain. I think that in some cases, keeping datastore Puts separate may make some the logic clearer, so when batching them together we should make sure that (1) the logic is still clear and (2) it actually improves performance.
Some places where potential improvements could be made include:
- frontend/rpc_analyze.go (putting GerritChangeIDtoRunID and AnalyzeRequestResult)
- gerrit/poll.go (putting entities related to changes and projects)
- and maybe others.
Comment 1 by no...@chromium.org
, May 9 2018