-
-
Save anonymous/0f7b3a92894b86d41c19 to your computer and use it in GitHub Desktop.
handling keyword args
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
jupiter:~/JAVA/swf-converter-conversion-node$ time ruby -le ' | |
def foo(*args, **kwargs) | |
kwargs | |
end | |
10000.times { foo(1,2,3,{a:1, b: 2}) } | |
' | |
real 0m0.048s | |
user 0m0.032s | |
sys 0m0.016s | |
jupiter:~/JAVA/swf-converter-conversion-node$ time python -c 'import itertools | |
def foo( *args, **kwargs): | |
kwargs | |
for _ in itertools.repeat(None, 10000): | |
foo(1,2,3, a=1, b=2) | |
' | |
real 0m0.019s | |
user 0m0.012s | |
sys 0m0.008s | |
jupiter:~/JAVA/swf-converter-conversion-node$ time perl6 -e ' | |
sub foo(*@args, *%kwargs) { | |
%kwargs | |
} | |
for 1..100000 { foo(1,2,3,a=> 1, b => 2) } | |
' | |
real 0m33.831s | |
user 0m33.295s | |
sys 0m0.504s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment