summaryrefslogtreecommitdiffstats
path: root/base/bind.h.pump
diff options
context:
space:
mode:
authorajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-28 22:13:54 +0000
committerajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-28 22:13:54 +0000
commitfccef1559e02b001c69a0d35ad960e37dcbfd650 (patch)
treeb3ddaa715bf24e5d44a134b7298f39e59b2c1f27 /base/bind.h.pump
parent485c5558393ab8fa34c580eed539a37d9d8f1450 (diff)
downloadchromium_src-fccef1559e02b001c69a0d35ad960e37dcbfd650.zip
chromium_src-fccef1559e02b001c69a0d35ad960e37dcbfd650.tar.gz
chromium_src-fccef1559e02b001c69a0d35ad960e37dcbfd650.tar.bz2
Increase Bind/Callback Arity from 6 -> 7.
A few functions need this and the expected compile-speed impact is low. We should be careful when raising this number higher. If you're binding a function that has more parameters than this supports, consider refactoring your API to use a parameter struct or something. Template equation: (n^2 + 26n) / 2 Template growth: 96 -> 116 types. BUG=98542 TEST=try bots Review URL: http://codereview.chromium.org/8728010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111788 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/bind.h.pump')
-rw-r--r--base/bind.h.pump20
1 files changed, 19 insertions, 1 deletions
diff --git a/base/bind.h.pump b/base/bind.h.pump
index 11b4667..9d4c5ee 100644
--- a/base/bind.h.pump
+++ b/base/bind.h.pump
@@ -5,7 +5,25 @@ $$
$$ http://code.google.com/p/googletest/wiki/PumpManual
$$
-$var MAX_ARITY = 6
+$$
+$$ MAX_ARITY controls the number of arguments that Bind() supports.
+$$ The amount of code, and more importantly, the number of template types
+$$ generated by pump grows at O(MAX_ARITY^2).
+$$
+$$ We tried going to 11 and found it imposed an extra 10 penalty on windows
+$$ cycle times compared to our original baseline of 6.
+$$
+$$ Currently 7 is chosen as a compromise between supporting a convenient
+$$ number of arguments and keeping compile times low. At 7, we have 115
+$$ templates being generated by pump.
+$$
+$$ Be careful when adjusting this number. If people find a need to bind
+$$ a larger number of arguments, consider refactoring the function to use
+$$ a param struct instead of raising the MAX_ARITY.
+$$
+$$ See http://crbug.com/98542 for more context.
+$$
+$var MAX_ARITY = 7
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be