Skip to content

Instantly share code, notes, and snippets.

View owent's full-sized avatar

WenTao Ou owent

View GitHub Profile
@owent
owent / README.md
Last active April 22, 2020 08:30
C++20 Coroutine jump

Clang C++20 Coroutine ASM

编译

# 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
@owent
owent / README.md
Last active November 9, 2023 17:47
coroutine benckmark

Benchmark Data

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
@owent
owent / README.md
Created March 8, 2018 12:13
libwebsockets+libuv最小化sample

编译脚本:

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 \
@owent
owent / test_backtrace.cpp
Last active June 4, 2022 02:14
test_backtrace
/**
* 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
@owent
owent / goroutine_benchmark.go
Last active June 7, 2018 09:25
goroutine benchmark
package main
import (
"fmt"
"os"
"strconv"
"time"
)
func runCallback(in, out chan int64) {
@owent
owent / output fot test4
Created May 20, 2017 09:54
VC和GCC成员函数指针实现的研究
# 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
@owent
owent / compile command.sh
Created May 15, 2017 08:53
boost.context.callcc.benchmark
#!/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编辑器的个人偏好配置

@owent
owent / benchmark-zeromq.md
Last active July 27, 2023 02:25
zeromq 集群模型压力测试

README

proxyd进程

proxyd有一个接受endpoint,并会监听一个内部地址和一个外部地址

内部地址用于连接本机的serverd,外部地址用于和其他集群的proxyd通信

proxyd对内部serverd发送消息采用zmq router节点,对每个外部proxyd都会建立一个zmq dealer节点与之通信

@owent
owent / lnmp.sh
Last active August 29, 2015 13:57
Lnmp yum 安装脚本 (for CentOS)
#!/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