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

Unified Diff: base/bind.h.pump

Issue 8728010: Increase Bind/Callback Arity from 6 -> 7. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated comments. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/bind.h ('k') | base/bind_internal.h » ('j') | base/bind_internal.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/bind.h.pump
diff --git a/base/bind.h.pump b/base/bind.h.pump
index 11b46670fcb11b788250f8abf49bb2f2bbf0d71f..9d4c5eef3bf4f5529393fc46e9f4f7336cbc07b4 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
« no previous file with comments | « base/bind.h ('k') | base/bind_internal.h » ('j') | base/bind_internal.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698