Last active
December 8, 2018 05:26
-
-
Save geolimber/64829303f3b1fb2f78ae9fd8f5868eb6 to your computer and use it in GitHub Desktop.
Just small perfomance test of map and list comp.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# map test without lambda | |
python3 -mtimeit -s'xs=range(10)' 'map(hex, xs)' | |
python3 -mtimeit -s'xs=range(10)' '[hex(x) for x in xs]' | |
# map lambda test | |
python3 -mtimeit -s'xs=range(10)' 'map(lambda x: x+2, xs)' | |
python3 -mtimeit -s'xs=range(10)' '[x+2 for x in xs]' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment