# Linux
/data/prebuilt/load-llvm-envs.sh clang++ -std=c++2a -O2 -g -ggdb -stdlib=libc++ -fcoroutines-ts -lc++ -lc++abi test-coroutine.cpp -o test-coroutine
./test-coroutine
2019-09-29 更新一版运行结果,增加 C++20 Coroutine 测试结果
组件(Avg) | 协程数:1 切换开销 | 协程数:1000 创建开销 | 协程数:1000 切换开销 | 协程数:30000 创建开销 | 协程数:30000 切换开销 |
---|---|---|---|---|---|
栈大小(如果可指定) | 16 KB | 2 MB | 2 MB | 64 KB | 64 KB |
C++20 Coroutine - Clang | 5 ns | 130 ns | 6 ns | 136 ns | 9 ns |
C++20 Coroutine - MSVC | 10 ns | 407 ns | 14 ns | 369 ns | 28 ns |
[libcopp][1] | 77 ns | 4.1 us | 105 ns | 3.8 us | 273 ns |
编译脚本:
g++ *.cpp -o test.exe -O0 -g -ggdb -std=c++11 -Wall \
/mnt/d/workspace/prebuilt/wsl/libuv/lib/libuv.a \
-I/mnt/d/workspace/prebuilt/wsl/libuv/include \
-I/mnt/d/workspace/prebuilt/wsl/libwebsockets/include \
-L/lib/x86_64-linux-gnu \
-L/mnt/d/workspace/prebuilt/wsl/libuv/lib \
-L/mnt/d/workspace/prebuilt/wsl/libwebsockets/lib \
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
/** | |
* traceback for cpp | |
* | |
* Created on: 2018-01-27 | |
* Author: owent | |
* | |
* Released under the MIT license | |
* | |
* @note Required flag -rdynamic or addr2line to get the function name when using gcc/clang in unix like system | |
* @note Using addr2line -Cfpe <exe_path> [func_addr...] for more detail when using gcc/clang |
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
package main | |
import ( | |
"fmt" | |
"os" | |
"strconv" | |
"time" | |
) | |
func runCallback(in, out chan int64) { |
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
# g++ test4.cpp -g -ggdb -O0 -o test4 && ./test4 | |
# gcc version: 5.4.0 (Ubuntu 16.04 LTS) | |
word size = 8 | |
sizeof vptr = 16 | |
info:15 | |
info:31 | |
info:44 | |
info:44 | |
print:35 |
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
#!/bin/bash | |
# we assume boost (1.64 and upper) is installed in $BOOST_PREBUILT | |
BOOST_LIB_DIR=$BOOST_PREBUILT/lib; | |
g++ context_cc_text.cpp -O2 -g -ggdb -I$BOOST_PREBUILT/include -L$BOOST_LIB_DIR \ | |
-lboost_context -lboost_system -lboost_thread -lboost_chrono \ | |
-std=c++11 -o context_cc_text |
用于同步Atom编辑器的个人偏好配置
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
#!/bin/sh | |
WORKING_DIR="$PWD"; | |
ARCH_FLAG=$(getconf LONG_BIT); | |
PHP_CONF_FILE_PATH=/etc/php.ini | |
PHP_CONF_DIR_PATH=/etc/php.d | |
PHP_FPM_CONF_FILE_PATH=/etc/php-fpm.d/www.conf | |
PHP_CACHE_DIR_PATH=/tmp/php/cache | |
PHP_EXT_LOG_DIR_PATH=/var/log/php |
NewerOlder