Skip to content

Instantly share code, notes, and snippets.

View StephanDollberg's full-sized avatar

Stephan Dollberg StephanDollberg

View GitHub Profile
#include <cstddef>
#include <utility>
#include <atomic>
#include <thread>
#include <iostream>
namespace aeron
{
@StephanDollberg
StephanDollberg / O1 assembly
Last active January 16, 2023 22:34
AtomicArrayUpdater bug
O1
263136 0000000000519690 <aeron::concurrent::AtomicArrayUpdater<long>::load() const>:
263137 519690: 55 push rbp
263138 519691: 48 89 e5 mov rbp,rsp
263139 519694: 41 57 push r15
263140 519696: 41 56 push r14
263141 519698: 53 push rbx
263142 519699: 50 push rax
263143 51969a: 4c 8d 4f 08 lea r9,[rdi+0x8]
@StephanDollberg
StephanDollberg / lambda_size.cpp
Last active October 27, 2019 17:33
lambda size
#include <cstdio>
int main() {
int x = 23;
int y = 45;
auto l1 = [] () {
std::printf("l1\n");
};
@StephanDollberg
StephanDollberg / io_context_latency.cpp
Last active October 27, 2019 11:46
io_context poll latency
#include <iostream>
#include <chrono>
#include <boost/asio/io_context.hpp>
#include <boost/asio/spawn.hpp>
#include <boost/asio/steady_timer.hpp>
int main(int argc, char* argv[])
{
boost::asio::io_context io_context(BOOST_ASIO_CONCURRENCY_HINT_1);
before
done
==17872==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7fff058e0000; bottom 0x631000022000; size:
0x1cef058be000 (31812915814400)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
excep handler
before
================
@StephanDollberg
StephanDollberg / no_prefault.svg
Created January 3, 2019 08:12
abseil raw_hash_map with/without prefaulting
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@StephanDollberg
StephanDollberg / .cpp
Created December 26, 2018 11:31
Prefault comparison
#include <benchmark/benchmark.h>
#include <absl/container/flat_hash_map.h>
#define BENCH_SIZES ->Arg(1000)->Arg(1000000)->Arg(10000000)
template <typename Map>
void fill_map(Map& map, const std::uint64_t size) {
for (std::uint64_t i = 0 ; i < size; ++i) {
map.try_emplace(i, i*2);
}
@StephanDollberg
StephanDollberg / memcached
Last active September 30, 2016 13:25
twemproxy bench / DO 8 core machine
./clients/memslap -s 127.0.0.1:11211/20000 -S 5s -T 4 -c 200
twemcache direct
Get Statistics
Type Time(s) Ops TPS(ops/s) Net(M/s) Get_miss Min(us) Max(us) Avg(us) Std_dev Geo_dist
Period 5 637239 127447 132.2 143267 70 27985 1406 966.24 1239.16
Global 5 637239 127447 132.2 143268 70 27985 1406 966.24 1239.16
Set Statistics
Type Time(s) Ops TPS(ops/s) Net(M/s) Get_miss Min(us) Max(us) Avg(us) Std_dev Geo_dist
@StephanDollberg
StephanDollberg / jwt auth example
Created February 12, 2015 09:15
jwt auth example
package main
import (
"github.com/ant0ine/go-json-rest/rest"
"log"
"net/http"
)
func handle_auth(w rest.ResponseWriter, r *rest.Request) {
w.WriteJson(map[string]string{"authed": r.Env["REMOTE_USER"].(string)})
@StephanDollberg
StephanDollberg / gist:9324109
Created March 3, 2014 12:38
hammer -v template info --id
[inf@head foreman_version_control]$ hammer -v template info --id 1
[ INFO 2014-03-03 13:36:08 Init] Initialization of Hammer CLI (0.0.18) has started...
[ INFO 2014-03-03 13:36:08 Init] Configuration from the file /etc/foreman/cli_config.yml has been loaded
[ INFO 2014-03-03 13:36:08 Modules] Extension module hammer_cli_foreman (0.0.18) loaded
[ INFO 2014-03-03 13:36:08 HammerCLI::MainCommand] Called with options: {"option_verbose"=>true}
[ INFO 2014-03-03 13:36:08 HammerCLIForeman::Template] Called with options: {}
[ INFO 2014-03-03 13:36:08 HammerCLIForeman::Template::InfoCommand] Called with options: {"option_id"=>"1"}
[DEBUG 2014-03-03 13:36:08 Connection] Registered: foreman_ConfigTemplate
[DEBUG 2014-03-03 13:36:08 ForemanApi::Resources::ConfigTemplate] Calling 'show' with params {
"id" => "1"