Skip to content

Instantly share code, notes, and snippets.

View davll's full-sized avatar

David Lin davll

View GitHub Profile
@davll
davll / Example1.cpp
Created February 1, 2020 19:42
C++ Exception Benchmark
static void without_exception(benchmark::State &state){
for (auto _ : state){
std::vector<uint32_t> v(10000);
for (uint32_t i = 0; i < 10000; i++) {
v.at(i) = i;
}
}
}
BENCHMARK(without_exception);//----------------------------------------
// Place your settings in this file to overwrite the default settings
{
"editor.fontSize": 18,
"terminal.integrated.fontSize": 16,
"rust.rustLangSrcPath": "%UserProfile%\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\src\\rust\\src",
"rust.cargoPath": "%UserProfile%\\.cargo\\bin\\cargo.exe",
"rust.cargoHomePath": "%UserProfile%\\.cargo"
}
@davll
davll / 0000-coroutine.md
Last active November 3, 2016 17:17
Coroutine RFC
  • Feature Name: (fill me in with a unique ident, my_awesome_feature)
  • Start Date: (fill me in with today's date, YYYY-MM-DD)
  • RFC PR: (leave this empty)
  • Rust Issue: (leave this empty)

Summary

One para explanation of the feature.

#[repr(u8)]
#[derive(Copy, Clone, PartialEq, Debug)]
/// Fragment-wise comparison function
pub enum CmpFunc {
/// `false`
Never = 0b000,
/// `S < D`
Less = 0b001,
/// `S == D`
Equal = 0b010,
macro_rules! cmds {
{ $(
$( $api:ident ( $x:expr, $y:expr ) ),+ => ;
)+ } => {
concat!( $(
concat!($( cmd!($api ($x, $y)) ),*)
),+ )
}
}
@davll
davll / auto-deploy.md
Created April 19, 2016 15:58 — forked from domenic/0-github-actions.md
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with Travis

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

Create a compile script

You want a script that does a local compile to e.g. an out/ directory. Let's call this compile.sh for our purposes, but for your project it might be npm build or gulp make-docs or anything similar.

The out/ directory should contain everything you want deployed to gh-pages. That almost always includes an index.html.

@davll
davll / flost.rs
Created April 5, 2016 13:03
vectormath lib pastes
/// Comparison
pub trait Cmp {
/// Corresponding boolean type
type Bool;
/// Test equality
fn eq(self, rhs: Self) -> Self::Bool;
/// Test inequality
fn ne(self, rhs: Self) -> Self::Bool;
/// Test greater than
fn gt(self, rhs: Self) -> Self::Bool;
@davll
davll / environ-vars.sh
Last active January 14, 2016 03:34
Rust Cross-Compiler Setup
export RUST_PREFIX=/d/Rust/head
@davll
davll / fstab
Created December 21, 2015 07:21
MSYS Settings
# For a description of the file format, see the Users Guide
# http://cygwin.com/cygwin-ug-net/using.html#mount-table
# DO NOT REMOVE NEXT LINE. It remove cygdrive prefix from path
none / cygdrive binary,posix=0,noacl,user 0 0
C:/Users /home ntfs binary,posix=0,noacl,user 0 0
@davll
davll / Resource.cpp
Created December 17, 2015 02:53
Resource Management
#include "Thales/Resource.h"
#include <string.h>
namespace Thales {
ResourceManager::ResourceManager(IResourceFinder* finder)
: m_Finder(finder)
{
for (int i = 0; i < MAX_TYPE_COUNT; ++i)
m_Factories[i] = NULL;