From 1927810547c7af41bcbcb93a9822438d381ee3cd Mon Sep 17 00:00:00 2001 From: Mathias Stearn Date: Fri, 24 Feb 2017 12:12:53 -0500 Subject: SERVER-28099 Use key rather than cmp in libdeps.py sorted_by_str From the python docs: "In general, the key and reverse conversion processes are much faster than specifying an equivalent cmp function. This is because cmp is called multiple times for each list element while key and reverse touch each element only once." --- site_scons/libdeps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'site_scons') diff --git a/site_scons/libdeps.py b/site_scons/libdeps.py index c20eb881d0a..153c551290b 100644 --- a/site_scons/libdeps.py +++ b/site_scons/libdeps.py @@ -68,7 +68,7 @@ def sorted_by_str(iterable): across invocations of SCons. Since dependency order changes force rebuilds, we use this sort to create stable dependency orders. """ - return sorted(iterable, cmp=lambda lhs, rhs: cmp(str(lhs), str(rhs))) + return sorted(iterable, key=str) class DependencyCycleError(SCons.Errors.UserError): """Exception representing a cycle discovered in library dependencies.""" -- cgit v1.2.1