Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Issue 2594463002: Don't allcoate a new math/rand every request. (Closed)

Created:
4 years ago by dnj
Modified:
4 years ago
Reviewers:
Vadim Sh.
CC:
chromium-reviews, infra-reviews+luci-go_chromium.org, maruel+w_chromium.org, tandrii+luci-go_chromium.org
Target Ref:
refs/heads/master
Project:
luci-go
Visibility:
Public.

Description

Don't allcoate a new math/rand every request. Use a global math/rand instance, rather than re-allocating one for each request. BUG=chromium:675485 TEST=None R=vadimsh@chromium.org Review-Url: https://codereview.chromium.org/2594463002 Committed: https://github.com/luci/luci-go/commit/fd0a102c24af05830dccbce7aeb7cf8d3295e90c

Patch Set 1 #

Total comments: 2

Patch Set 2 : Lock comment. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -0 lines) Patch
M appengine/gaemiddleware/context.go View 1 3 chunks +8 lines, -0 lines 0 comments Download

Messages

Total messages: 14 (6 generated)
dnj
PTAL. I'm seeing a lot of math/rand allocations in my app's heap, and AFAICT there's ...
4 years ago (2016-12-20 00:50:41 UTC) #1
Vadim Sh.
lgtm Another approach is to keep a sync.Pool of RNG instances and give each request ...
4 years ago (2016-12-20 00:55:02 UTC) #2
dnj
On 2016/12/20 00:55:02, Vadim Sh. wrote: > lgtm > > Another approach is to keep ...
4 years ago (2016-12-20 00:56:31 UTC) #3
Vadim Sh.
https://codereview.chromium.org/2594463002/diff/1/appengine/gaemiddleware/context.go File appengine/gaemiddleware/context.go (right): https://codereview.chromium.org/2594463002/diff/1/appengine/gaemiddleware/context.go#newcode66 appengine/gaemiddleware/context.go:66: // globalMathRand is a global "math/rand" instance. actually, nit: ...
4 years ago (2016-12-20 00:56:37 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2594463002/1
4 years ago (2016-12-20 00:56:42 UTC) #6
dnj
https://codereview.chromium.org/2594463002/diff/1/appengine/gaemiddleware/context.go File appengine/gaemiddleware/context.go (right): https://codereview.chromium.org/2594463002/diff/1/appengine/gaemiddleware/context.go#newcode66 appengine/gaemiddleware/context.go:66: // globalMathRand is a global "math/rand" instance. On 2016/12/20 ...
4 years ago (2016-12-20 00:58:49 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2594463002/20001
4 years ago (2016-12-20 00:59:12 UTC) #11
commit-bot: I haz the power
4 years ago (2016-12-20 01:06:50 UTC) #14
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as
https://github.com/luci/luci-go/commit/fd0a102c24af05830dccbce7aeb7cf8d3295e90c

Powered by Google App Engine
This is Rietveld 408576698