Skip to content

Instantly share code, notes, and snippets.

View carlobaldassi's full-sized avatar

Carlo Baldassi carlobaldassi

View GitHub Profile
@carlobaldassi
carlobaldassi / nullablerand.jl
Last active August 29, 2015 14:13
NullableVector performance with random access
module NV
immutable NullableVector{T}
isnull::BitVector
values::Vector{T}
end
@inline Base.length(nv::NullableVector) = length(nv.isnull)
@inline function Base.getindex(nv::NullableVector{Float64}, i::Integer)
@carlobaldassi
carlobaldassi / PartSort.jl
Last active August 29, 2015 14:18
partial select
module PartSort
using Base.Order
import Base: sort!, Sort.Algorithm
export PartialQuickSort
immutable PartialQuickSort <: Algorithm
k::Int
@carlobaldassi
carlobaldassi / intvec_abstractsmart.txt
Last active August 29, 2015 14:20
abstractsmart benchmarking
abstractvector getindex A[I]
---------------------
A::BitArray I::Vector{Int}
elapsed time: 0.271078954 seconds (4 MB allocated)
A::Array{Bool} I::Vector{Int}
elapsed time: 0.096585028 seconds (35 MB allocated)
A::Array{Float64} I::Vector{Int}
elapsed time: 0.267021423 seconds (286 MB allocated)
abstractvector setindex! A[I]=X
@carlobaldassi
carlobaldassi / bitinitbug.jl
Last active January 20, 2017 22:50
Code to reproduce julia bug 20065
module BitBug
function copy_to_bitarray_chunks_simplified!(Bc::Vector{UInt64}, C::Array{Bool}, numbits::Int)
ld1 = numbits - 1
u = Base._msk64
msk_d1 = (u << (ld1+1))
ind = 1
@show C
@carlobaldassi
carlobaldassi / jld_alignment_issue.jl
Created July 24, 2018 11:39
scripts to reproduce JLD issues on julia 0.7
module Tst
using JLD
GC.gc()
Aarray = Vector{Float64}[[1.2,3.4],[1.1]]
str = "abc"
stringsA = ["x","y","z"]
strings16 = convert(Vector{JLD.UTF16String}, stringsA)
bigdata = [1:10000;]
@carlobaldassi
carlobaldassi / CBModules.diff
Created November 15, 2019 16:54
CBModules customizations diff
diff -r CBModules/ga/cbga.c CBModules.orig/ga/cbga.c
42c42
< #define MaxGenerations 1000
---
> #define MaxGenerations 100
154,155c154
< long watch,
< double errorscale)
---
> long watch)