Created
February 3, 2016 19:56
-
-
Save alsotang/34d5e0bc7329e0fb548f to your computer and use it in GitHub Desktop.
Node.js vs Python
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
var _ = require('lodash') | |
var length = 20000; | |
var arr = _.range(0, length); | |
console.time('add') | |
for (var i = 0; i < length; i++) { | |
for (var j = 0; j < length; j++) { | |
arr[j] += 1 | |
} | |
} | |
console.timeEnd('add') |
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
import datetime | |
length = 20000 | |
arr = range(length) | |
print datetime.datetime.now() | |
for i in xrange(length): | |
for j in xrange(length): | |
arr[j] += 1 | |
print datetime.datetime.now() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment