Skip to content

Instantly share code, notes, and snippets.

Avatar

Heyang Zhou losfair

View GitHub Profile
View backtrace-bug.rs
use backtrace::Backtrace;
use std::{mem, ptr};
#[inline(never)]
fn f(x: i32) -> i32 {
if x == 0 || x == 1 {
1
} else {
f(x - 1) + f(x - 2)
}
@losfair
losfair / coroutine.c
Created Jan 14, 2019
Coroutines: Lightweight Threads for Concurrency - Example code
View coroutine.c
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
asm(
"_co_switch:\n"
"push %rbx\n"
"push %rbp\n"
"push %r12\n"
"push %r13\n"
@losfair
losfair / benchmarks.md
Created Aug 1, 2018
WebAssembly VM Benchmarks
View benchmarks.md
@losfair
losfair / IceNodeApplicationBenchmarkResult.txt
Created Jul 20, 2017
IceNodeApplicationBenchmarkResult
View IceNodeApplicationBenchmarkResult.txt
Ice-node:
Target: http://127.0.0.1:6001
Threads: 100
Target: http://127.0.0.1:6001
Threads: 100
Target: http://127.0.0.1:6001
Threads: 100
Target: http://127.0.0.1:6001
Threads: 100
@losfair
losfair / IceNodeBenchmarkResults.txt
Created Jul 18, 2017
Ice-node Benchmark Results
View IceNodeBenchmarkResults.txt
$ ab -n 200000 -c 1000 http://127.0.0.1:1122/hello_world
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 20000 requests
Completed 40000 requests
Completed 60000 requests
Completed 80000 requests
View exec_logger.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
static __attribute__((constructor)) void hook_init(void) {
int fd,len,i;
char *cmdline;
cmdline=malloc(65536);