[isolate] Simplify uploadToCAS
[isolate] Simplify uploadToCAS

Reduce amount of contention and memory usage.
Also preallocate slices/maps where possible.

Change-Id: I7a9c9e6ea315871286d32afbfbac0b002072e94d
Reviewed-on: https://chromium-review.googlesource.com/c/infra/luci/luci-go/+/2823926
Reviewed-by: Takuto Ikuta <71927f930fca81015e0f496c65cd126ab1a692e3@chromium.org>
Commit-Queue: Nodir Turakulov <ef4933a197ef7b4b3f55f1bec4942aead3637a2a@chromium.org>

luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go