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
=== time === | |
iostream.py:708 write_to_fd 49.797434 | |
iostream.py:773 set_nodelay 31.600270 | |
iostream.py:696 read_from_fd 15.023633 | |
kqueue.py:67 poll 2.160702 | |
<frozen importlib._bootstrap>:1879 _path_importer_cache 0.101283 | |
<frozen importlib._bootstrap>:656 _compile_bytecode 0.101283 | |
web.py:1379 <listcomp> 0.067522 | |
web.py:1378 _generate_headers 0.067522 | |
<frozen importlib._bootstrap>:321 _call_with_frames_removed 0.033761 |
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
474286 function calls (468756 primitive calls) in 38.130 seconds | |
Ordered by: call count | |
ncalls tottime percall cumtime percall filename:lineno(function) | |
38848 0.016 0.000 0.023 0.000 {built-in method isinstance} | |
24354/24259 0.004 0.000 0.004 0.000 {built-in method len} | |
13000 0.012 0.000 0.023 0.000 escape.py:193(utf8) | |
12012/12011 0.004 0.000 0.007 0.000 {method 'encode' of 'str' objects} | |
11202 0.013 0.000 0.013 0.000 {built-in method hasattr} |
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
#micro benchmark | |
#CPython 3.4.1 | |
import timeit | |
print(timeit.timeit("utf8('xyzzy')", "from tornado.escape import utf8")) | |
# $ TORNADO_EXTENSION=1 python u8bench.py | |
# 0.0813535709748976 | |
# $ TORNADO_NO_EXTENSION=1 python u8bench.py | |
# 0.8695125280064531 |
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 ( | |
"bufio" | |
"bytes" | |
"errors" | |
"fmt" | |
"log" | |
"net" | |
"os" |
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 ( | |
"io" | |
"log" | |
"net" | |
"sync" | |
"time" | |
) |
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
methane@raring:~$ uname -a | |
Linux raring 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux | |
methane@raring:~$ gcc -O2 -o gt gt.c | |
methane@raring:~$ time ./gt | |
called 1000000 times, last value is 1412062858.602343 | |
real 0m2.219s | |
user 0m2.215s | |
sys 0m0.005s |
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
YYY YYY | |
RRR RRR | |
BBB BBB | |
GGG GGG |
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 ( | |
"log" | |
"net/http" | |
) | |
func hello(w http.ResponseWriter, r *http.Request) { | |
w.Header().Add("Content-Type", "text/plain") | |
w.Write([]byte("Hello, World.")) |
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
ROUTINE ====================== net/http.ReadRequest | |
11 403 samples (flat, cumulative) 27.2% of total | |
-------------------- /home/ec2-user/local/go/src/net/http/request.go | |
2 2 591: func ReadRequest(b *bufio.Reader) (req *Request, err error) { | |
. . 447b70: FS MOVQ FS:0xfffffff0, CX | |
2 2 447b79: LEAQ 0xffffff30(SP), AX | |
. . 447b81: CMPQ 0x10(CX), AX | |
. . 447b85: JA 0x447b8e | |
. . 447b87: CALL runtime.morestack_noctxt(SB) | |
. . 447b8c: JMP net/http.ReadRequest(SB) |
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
$ python -c "import sys; print(sys.stdout.encoding)" | |
UTF-8 | |
$ python -c "import sys; print(sys.stdout.encoding)" | cat | |
None | |
$ PYTHONIOENCODING=utf-8 python -c "import sys; print(sys.stdout.encoding)" | cat | |
utf-8 | |
$ python3 -c "import sys; print(sys.stdout.encoding)" | |
UTF-8 | |
$ python3 -c "import sys; print(sys.stdout.encoding)" | cat | |
UTF-8 |