Skip to content

Instantly share code, notes, and snippets.

James Cook jwscook

View GitHub Profile
@jwscook
jwscook / ThreadProblemMWE.jl
Last active Jun 23, 2020
Finding optimal threading of two consecutive double loops where some rows are skipped in the first double loop and the second double loop depends on the output of the first.
View ThreadProblemMWE.jl
using Base.Threads, Random
function run(;waittime=1.0e-3)
function calcsubset(N)
Random.seed!(0)
return sort(shuffle(collect(1:N))[1:Int(ceil(round(N / 3)))])
end
# we know that only a sorted subset of rows need be iterated over for the first loop
@jwscook
jwscook / Functionals.jl
Created Jun 9, 2018
Avoiding functions in types; performance comparison & invitation for code review
View Functionals.jl
module Functionals
abstract type Abstract end
type Functional <: Abstract
lower::Float64
upper::Float64
end
Functional(t::Float64) = Functional(0.0, 12.0 * t)
You can’t perform that action at this time.