code like this is very tricky affair without numbersthoughit' virtually impossible to guess which method will perform the best--the best you can do is time your own codeon your computerwith your version of python in this casewhat we can say for certain is that on this pythonusing user-defined function in map calls seems to slow performance substantially (though may also be slower than trivial abs)and that list comprehensions run quickest in this case (though slower than map in some otherslist comprehensions seem consistently twice as fast as for loopsbut even this must be qualified--the list comprehension' relative speed might be affected by its extra syntax ( if filters)python changesand usage modes we did not time here as 've mentioned beforehoweverperformance should not be your primary concern when writing python code--the first thing you should do to optimize python code is to not optimize python codewrite for readability and simplicity firstthen optimize laterif and only if needed it could very well be that any of the five alternatives is quick enough for the data sets your program needs to processif soprogram clarity should be the chief goal for deeper truthchange this code to apply simple user-defined function in all five iteration techniques timed for instance (from timeseqs py of the book' examples)def ( )return def listcomp()return [ (xfor in repslistdef mapcall()return list(map(frepslist)the resultsin file timeseqs-results txtare then relatively similar to using built-in function like abs--at least in cpythonmap is quickest more generallyamong the five iteration techniquesmap is fastest today if all five call any functionbuilt in or notbut slowest when the others do not that ismap appears to be slower simply because it requires function callsand function calls are relatively slow in general since map can' avoid calling functionsit can lose simply by associationthe other iteration tools win because they can operate without function calls we'll prove this finding in tests run under the timeit module ahead timing module alternatives the timing module of the preceding section worksbut it could be bit more userfriendly most obviouslyits functions require passing in repetitions count as first argumentand provide no default for it-- minor pointperhapsbut less than ideal in general-purpose tool we could also leverage the min technique we saw earlier to simplify the return value slightly and remove minor overhead charge the benchmarking interlude