Skip to content

Instantly share code, notes, and snippets.

[package]
name = "binaryheap"
version = "0.1.0"
authors = [ "a.beingessner@gmail.com" ]
[[bin]]
name = "binaryheap" # the name of the executable to generate
@Gankra
Gankra / gist:06b4c5454bd4f3ef732a
Last active August 29, 2015 14:04
libcollections traits 0.1
pub trait Collection {
fn len(self) -> uint;
fn is_empty(&self) -> bool; //defaulted
}
pub trait Mutable: Collection {
fn clear(&mut self);
}
pub trait Container<T>: Collection {
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `result=""; for arch in i386; do if gcc -arch $arch -c -integrated-as /c/users/alexis/Documents/Github/rust/src/compiler-rt/make/platform/clang_darwin_test_input.c -isysroot /c/users/alexis/Documents/Github/rust/src/compiler-rt/SDKs/darwin -o /dev/null > /dev/null 2> /dev/null; then if c:/program files (x86)/mingw-builds/x32-4.8.1-win32-dwarf-rev5/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.8.1/../../../../i686-w64-mingw32/bin/ld.exe -v 2>&1 | grep "configured to support" | tr ' ' '\n' | grep "^$arch$" >/dev/null 2>/dev/null; then result="$result$arch "; else printf 1>&2 "warning: clang_darwin.mk: dropping arch '$arch' from lib 'eprintf'"; printf 1>&2 " (ld does not support it)\n"; fi; else printf 1>&2 "warning: clang_darwin.mk: dropping arch '$arch' from lib 'eprintf'"; printf 1>&2 " (clang does not support it)\n"; fi; done; echo $result'
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `result="";
@Gankra
Gankra / traits.rs
Last active August 29, 2015 14:04
libcollections traits 0.2
/********************************************
****************COMMON **********************
********************************************/
/// Base trait that all collections should inherit from
/// Due to the way the Rust's type system works, a perfectly generic
/// collection of T's can support very few operations. In particular, the
/// ability to store things that *don't* implement Eq, and the
/// distinction between value stores and key-value stores means
C:\Users\Alexis\Documents\GitHub\rust [mathjax +0 ~1 -0]> git status
# On branch mathjax
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: src/llvm (new commits)
#
no changes added to commit (use "git add" and/or "git commit -a")
C:\Users\Alexis\Documents\GitHub\rust [mathjax +0 ~1 -0]> git diff
compile: x86_64-unknown-linux-gnu/rustllvm/RustWrapper.o
/home2bak/abeinges/rust2/src/rustllvm/RustWrapper.cpp: In function ‘LLVMOpaqueValue* LLVMDIBuilderCreateSubroutineType(DIBuilderRef, LLVMValueRef, LLVMValueRef)’:
/home2bak/abeinges/rust2/src/rustllvm/RustWrapper.cpp:285:18: error: ‘DITypeArray’ was not declared in this scope
unwrapDI<DITypeArray>(ParameterTypes)));
^
/home2bak/abeinges/rust2/src/rustllvm/RustWrapper.cpp:285:45: error: no matching function for call to ‘unwrapDI(LLVMOpaqueValue*&)’
unwrapDI<DITypeArray>(ParameterTypes)));
^
/home2bak/abeinges/rust2/src/rustllvm/RustWrapper.cpp:285:45: note: candidate is:
/home2bak/abeinges/rust2/src/rustllvm/RustWrapper.cpp:230:5: note: template<class DIT> DIT unwrapDI(LLVMValueRef)
@Gankra
Gankra / gist:93b2de2505ef438f1a0e
Last active August 29, 2015 14:07
libcollections documentation performance companion

This is written as a companion to the Rust collections library documentation. It provides an intuitive explanation of performance analysis in the context of data structures, with Rust's collections in mind.

Measuring Performance

The performance of a collection is a difficult thing to precisely capture. One cannot simply perform an operation and measure how long it takes or how much space is used, as the results will depend on details such as how it was compiled, the hardware it's running on, the software managing its execution, and

// set the matrix as a yaw rotation matrix
// if degree is true (!=0) then angle is given in degrees
// otherwise angle is given in radians
static Matrix4f rotateY(float angle, int degree);
// Editor's note: THIS LIBRARY IS SUPPOSED TO BE FOR OPENGL WHAT
Matrix4f * getViewMatrix(D3DXMATRIX * viewMatrix);
----- C:/g/rust/src/test/run-make/c-dynamic-dylib/ --------------------
------ stdout ---------------------------------------------
make[1]: Entering directory '/c/g/rust/src/test/run-make/c-dynamic-dylib'
gcc -Wall -Werror -g -m64 -D_WIN32_WINNT=0x0600 -L /C/g/rust/x86_64-pc-windows-gnu/test/run-make/c-dynamic-dylib -c -o /C/g/rust/x86_64-pc-windows-gnu/test/run-make/c-dynamic-dylib/libcfoo.o cfoo.c
gcc -Wall -Werror -g -m64 -D_WIN32_WINNT=0x0600 -L /C/g/rust/x86_64-pc-windows-gnu/test/run-make/c-dynamic-dylib -o /C/g/rust/x86_64-pc-windows-gnu/test/run-make/c-dynamic-dylib/cfoo.dll /C/g/rust/x86_64-pc-windows-gnu/test/run-make/c-dynamic-dylib/libcfoo.o -shared
PATH="/C/g/rust/x86_64-pc-windows-gnu/test/run-make/c-dynamic-dylib:/C/g/rust/x86_64-pc-windows-gnu/stage2/bin:/mingw64/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/usr/bin:/c/ProgramData/Oracle/Java/javapath:/c/Program Files (x86)/Intel/iCLS Client:/c/Program Files/Intel/iCLS Client:/c/windows/system32:/c/windows:/c/windows/System32/Wbem:/c/windows/Sy
@Gankra
Gankra / gist:840b4a5eed0824d15d2b
Created November 22, 2014 20:46
libcollections benchmarks 2014-11-22
test bit::bitv_bench::bench_bitv_big_iter ... bench: 44040 ns/iter (+/- 28)
test bit::bitv_bench::bench_bitv_big_union ... bench: 2222 ns/iter (+/- 1)
test bit::bitv_bench::bench_bitv_set_big_fixed ... bench: 1386 ns/iter (+/- 1)
test bit::bitv_bench::bench_bitv_set_big_variable ... bench: 3093 ns/iter (+/- 2)
test bit::bitv_bench::bench_bitv_set_small ... bench: 1325 ns/iter (+/- 13)
test bit::bitv_bench::bench_bitv_small_iter ... bench: 881 ns/iter (+/- 4)
test bit::bitv_bench::bench_uint_small ... bench: 1175 ns/iter (+/- 26)
test bit::bitv_set_bench::bench_bitvset_big ... bench: 1410 ns/iter (+/- 13)
test bit::bitv_set_bench::bench_bitvset_iter ... bench: 46970 ns/iter (+/- 571)
test bit::bitv_set_bench::bench_bitvset_small ... bench: 1380 ns/iter (+/- 31)