Skip to content

Instantly share code, notes, and snippets.

@masnun
Last active December 15, 2015 17:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masnun/5300128 to your computer and use it in GitHub Desktop.
Save masnun/5300128 to your computer and use it in GitHub Desktop.
Mapping With Lambda
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
<?php
$data = array_map(function($y) { return array_map(function($z) use ($y) { return $z * $y;}, range(0,10)); },range(0,10000));
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