Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Matz danielmatz

  • Houston, TX
View GitHub Profile
@danielmatz
danielmatz / zeros_test.jl
Created Oct 18, 2016
Comparison of implementations of zeros
View zeros_test.jl
using BenchmarkTools
function zeros_calloc{S, N}(T::Type, dims::Vararg{S, N})
data = ccall((:calloc, "libc"),
Ptr{Void},
(Csize_t, Csize_t),
prod(dims), sizeof(T))
data == C_NULL && error("Failed to allocate memory")
ccall(:jl_ptr_to_array,
Array{T, N},
@danielmatz
danielmatz / fast.jl
Last active Aug 29, 2015
Understanding the Cost of Virtualization
View fast.jl
type ChildA
end
type ChildB
end
increment(c::ChildA, x) = x + 1
increment(c::ChildB, x) = x + 2
type Container
@danielmatz
danielmatz / fishtrace
Created Feb 22, 2015
Fish freezes and then crashes when the current directory is within a large hg-git repo
View fishtrace
Time Sum Command
1116 4995 > builtin source /usr/local/stow/fish-shell/share/fish/config.fish 2>/dev/null
68 68 -> set -g IFS \n\ \t
15 15 -> function __fish_default_command_not_found_handler...
17 17 -> function __fish_command_not_found_handler --on-event fish_command_not_found...
54 54 -> set -l configdir ~/.config
10 25 -> if set -q XDG_CONFIG_HOME...
15 15 --> set -q XDG_CONFIG_HOME
38 38 -> set -l userdatadir ~/.local/share
6 20 -> if set -q XDG_DATA_HOME...
View fish shell preprocessor output
# 1 "mimedb.cpp"
# 1 "/Users/dmatz/Data/Projects/fish-shell//"
# 1 "<command-line>"
# 1 "mimedb.cpp"
# 22 "mimedb.cpp"
# 1 "config.h" 1
# 23 "mimedb.cpp" 2
# 1 "/usr/include/string.h" 1 3 4
You can’t perform that action at this time.