Last active
December 15, 2015 17:59
-
-
Save masnun/5300128 to your computer and use it in GitHub Desktop.
Mapping With Lambda
This file contains 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
Lighthouse: ~/Codes/compare | |
→ time python test.py | |
python test.py 0.05s user 0.01s system 96% cpu 0.067 total | |
Lighthouse: ~/Codes/compare | |
→ time php test.php | |
php test.php 0.56s user 0.03s system 99% cpu 0.598 total | |
Lighthouse: ~/Codes/compare | |
→ | |
This file contains 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
<?php | |
$data = array_map(function($y) { return array_map(function($z) use ($y) { return $z * $y;}, range(0,10)); },range(0,10000)); |
This file contains 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
a = map(lambda y:[x*y for x in range(10)],range(10000)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment