Last active
June 3, 2021 16:17
-
-
Save tikazyq/e596f9c7b214b4f0b368570ed4ee21a0 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
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func main() { | |
st := time.Now() | |
n := 100000000 | |
for i := 0; i < n; i++ { | |
} | |
fmt.Println(fmt.Sprintf("%f seconds", float32(time.Now().Sub(st).Microseconds()) / 1000000)) | |
// 0.058280 seconds | |
} |
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
from datetime import datetime | |
st = datetime.now() | |
n = 100000000 | |
_ = [i for i in range(n)] | |
ed = datetime.now() | |
d = ed - st | |
print('%f seconds' % (d.seconds + d.microseconds / 1e6)) | |
# 3.965864 seconds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment