Skip to content

Instantly share code, notes, and snippets.

Jack O'Connor oconnor663

Block or report user

Report or block oconnor663

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@oconnor663
oconnor663 / main.c
Created Nov 10, 2019
Libsodium crypto_generichash demo
View main.c
#include <sodium.h>
#include <stdio.h>
#include <unistd.h>
int main() {
if (sodium_init() < 0) {
printf("init error\n");
return 1;
}
unsigned char hash[crypto_generichash_BYTES];
@oconnor663
oconnor663 / benches.txt
Last active Nov 3, 2019
baokeshed benchmarks
View benches.txt
AWS t3.nano (AVX-512)
=====================
# baokeshed
test bench_compress64_portable ... bench: 117 ns/iter (+/- 4) = 1094 MB/s
test bench_compress_portable ... bench: 84 ns/iter (+/- 3) = 761 MB/s
test bench_compress_sse41 ... bench: 69 ns/iter (+/- 2) = 927 MB/s
test bench_fficompress64_portable ... bench: 105 ns/iter (+/- 2) = 1219 MB/s
test bench_fficompress_avx512 ... bench: 59 ns/iter (+/- 1) = 1084 MB/s
test bench_fficompress_portable ... bench: 93 ns/iter (+/- 4) = 688 MB/s
@oconnor663
oconnor663 / Cargo.toml
Last active Oct 9, 2019
Windows race test
View Cargo.toml
[package]
name = "race"
version = "0.1.0"
authors = ["Jack O'Connor <oconnor663@gmail.com>"]
edition = "2018"
[dependencies]
os_pipe = "0.9.0"
[[bin]]
@oconnor663
oconnor663 / Cargo.toml
Created Sep 23, 2019
hash function benchmarks
View Cargo.toml
[package]
name = "scratch"
version = "0.1.0"
edition = "2018"
[dependencies]
rayon = "1.2.0"
blake2s_simd = "0.5.8"
@oconnor663
oconnor663 / main.rs
Last active Jun 5, 2019
interior pointers examples
View main.rs
fn bump_smaller(x: &mut i32, y: &mut i32) {
if *x <= *y {
*x += 1;
} else {
*y += 1;
}
}
fn main() {
// example with variables
@oconnor663
oconnor663 / data.txt
Created Apr 21, 2019
BLAKE2bp throughput varying across input byte offset
View data.txt
0 1.003
1 1.006
2 1.002
3 1.006
4 1.008
5 1.009
6 1.008
7 1.008
8 1.006
9 1.008
@oconnor663
oconnor663 / main.rs
Created Apr 3, 2019
dirty JSON with nom
View main.rs
use nom::types::CompleteStr;
use nom::*;
use std::collections::HashMap;
#[derive(Clone, Debug)]
enum Value {
Num(f64),
String(String),
List(Vec<Value>),
Object(HashMap<String, Value>),
@oconnor663
oconnor663 / main.rs
Created Apr 2, 2019
relaxed atomics
View main.rs
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::sync_channel;
use std::sync::{Arc, Barrier};
static MY_ORDERING: Ordering = Ordering::Relaxed;
static A: AtomicBool = AtomicBool::new(false);
static B: AtomicBool = AtomicBool::new(false);
fn main() {
@oconnor663
oconnor663 / lib.rs
Created Mar 25, 2019
slice reverse benchmark
View lib.rs
#![feature(test)]
extern crate test;
use std::ptr;
use test::Bencher;
pub fn reverse_slice_orig<T>(s: &mut [T]) {
let mut i: usize = 0;
let ln = s.len();
@oconnor663
oconnor663 / main.rs
Last active Mar 16, 2019
HN example without crossbeam
View main.rs
use serde::Deserialize;
use std::sync::{Arc, Mutex};
const STORIES_URL: &str = "https://hacker-news.firebaseio.com/v0/topstories.json";
const ITEM_URL_BASE: &str = "https://hacker-news.firebaseio.com/v0/item";
#[derive(Deserialize)]
struct Story {
title: String,
}
You can’t perform that action at this time.