-
-
Save lega911/c4b627c3f17625f05d44 to your computer and use it in GitHub Desktop.
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
// 0.403273203 sec | |
package main | |
import "fmt" | |
import "time" | |
func main() { | |
start := time.Now().UnixNano() | |
for i := 0; i < 1000000000; i++ { | |
} | |
finish := time.Now().UnixNano() | |
dur := float64(finish-start) | |
fmt.Println(dur / 1000000000) | |
} |
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
# 41.40947604179382 sec | |
import time | |
start = time.time() | |
for i in range(1000000000): | |
pass | |
finish = time.time() | |
print(finish-start) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Добавлю свои 5 копеек по питончику. Я, правда, не понял то ли у вас тут выше код суммирует числа от 1 до миллиарда, то ли суммирует миллиард единичек. Но я и такой и такой тест сделал.
Результаты:
Python 3.5.0:
PyPy
PyPy3