Skip to content

Instantly share code, notes, and snippets.

View VendettaReborn's full-sized avatar

V VendettaReborn

View GitHub Profile
@VendettaReborn
VendettaReborn / cache_padded_expr.rs
Created April 16, 2025 08:16
experiment in rust for cacheline false sharing
use std::sync::Arc;
use std::thread;
use std::time::Instant;
fn main() {
// Number of iterations for our test
const ITERATIONS: u64 = 100_000_000;
println!("Running cache false sharing experiment...");
println!("Iterations per thread: {}", ITERATIONS);
@VendettaReborn
VendettaReborn / dhat_expr.md
Last active April 13, 2025 19:40
clash-rs dhat experiment log

preparation

to do the experiment, you need to add some lines to the repo:

// clash_lib/src/lib.rs 

#[cfg(test)]
#[global_allocator]
static ALLOC: dhat::Alloc = dhat::Alloc;
@VendettaReborn
VendettaReborn / multi_layers_snafu_stack.rs
Created February 15, 2025 13:23
multi layers snafu stack trace demo
use snafu::{Location, ResultExt, Snafu};
use stack_error::ext::StackError;
use stack_error_macro::stack_trace_debug;
#[derive(Snafu)]
#[snafu(visibility(pub))]
#[stack_trace_debug]
pub enum GlobalGlobalError {
#[snafu(display("Package error: {source}"))]
GlobalError {
@VendettaReborn
VendettaReborn / error_stack_thiserror.rs
Created February 15, 2025 12:37
error backtrace stack in thiserror
#![feature(error_generic_member_access)]
#[derive(thiserror::Error, Debug)]
pub enum RustError {
#[error("Java error: {source}")]
Java {
#[from]
#[backtrace]
source: JavaError,
},
@VendettaReborn
VendettaReborn / shadow-tls-bootstrap.sh
Last active November 27, 2024 04:52
shadow-tls install script(ubuntu/centos/arch)
#! /bin/bash
red='\033[0;31m'
yellow='\033[1;33m'
blue='\033[0;34m'
green='\033[0;32m'
NC='\033[0m' # No Color
function echo_color()
{