Skip to content

Instantly share code, notes, and snippets.

@llogiq
llogiq / bench.rs
Created October 29, 2023 21:24
Small starts_with benchmark
/* Put this into Cargo.toml and the below code under benches/bench.rs:
[package]
name = "startbench"
version = "0.1.0"
edition = "2021"
[[bench]]
name = "bench"
harness = false
cd /home/andre/projects/this-week-in-rust
COMMAND="$1"
case "${COMMAND}" in
start)
git checkout master
git pull origin master
FILE=draft*/*.md
set $(head -n 2 ${FILE} | tail -n 1)
NUMBER="$2"
@llogiq
llogiq / fannkuch_redux.rs
Created September 4, 2018 20:19
single-threaded fannkuch_redux stdsimd version
use std::arch::x86_64::*;
#[derive(Copy, Clone, Debug)]
pub struct u8x16(__m128i);
impl Default for u8x16 {
fn default() -> Self { u8x16(unsafe { _mm_setzero_si128() }) }
}
impl u8x16 {
@llogiq
llogiq / clippy-ai2048.log
Created July 20, 2016 09:10
clippy run of ai2048
Compiling ai2048 v0.1.0 (file:///home/andre/projects/ai2048)
warning: you should put `ExpectiMax` between ticks in the documentation, #[warn(doc_markdown)] on by default
--> src/searcher.rs:1:64
|>
1 |> //! This is the meat of the library. This module implements an ExpectiMax search
|> ^^^^^^^^^^
help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#doc_markdown
warning: you should put `Expectiminimax_tree` between ticks in the documentation, #[warn(doc_markdown)] on by default
--> src/searcher.rs:2:36
@llogiq
llogiq / regex.dna.rs
Created April 22, 2016 20:45
benchmarksgame-rs regex-dna entry with byte matching
// The Computer Language Benchmarks Game
// http://benchmarksgame.alioth.debian.org/
//
// contributed by the Rust Project Developers
// contributed by TeXitoi
// contributed by BurntSushi
extern crate regex;
use regex::bytes::Regex;
i=1
(1..(args[0] as int)).each{i*=it}
print i
class D{public static void main(String[]a){for(int i=1;i<366;i+=7){System.out.println(new java.util.Date(116,0,i));}}}
class G{public static void main(String[]r){for(long a=0,b=1,i=0,c;i++<50;){c=a;a+=b;b=c;System.out.println(a);}}}
class F{public static void main(String[]r){int a=1,i=1;for(;i<=new Integer(r[0]);i++){a*=i;}System.out.print(a);}}
// The Computer Language Benchmarks Game
// http://benchmarksgame.alioth.debian.org/
//
// contributed by llogiq
//
// built on top of Joshua Landau's fasta
// built on top of Rust versions
// contributed by the Rust Project Developers
// contributed by TeXitoi
// multi-threaded version contributed by Alisdair Owens