Skip to content

Instantly share code, notes, and snippets.

julia> code_typed(DataFrame, (typeof(m),); debuginfo=:source)
1-element Array{Any,1}:
CodeInfo(
1 ─── goto #3 if not false
2 ─── nothing::Nothing
3 ┄── %3 = π (false, Const(false, false))
└──── goto #5 if not %3
4 ─── nothing::Nothing
5 ┄── %6 = (DataFrames.applicable)(DataFrames.iterate, x)::Bool
└──── goto #61 if not %6
@quinnj
quinnj / Manifest.toml
Created September 28, 2018 05:58
Compiler hang
[[Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
[[BinaryProvider]]
deps = ["Libdl", "Pkg", "SHA", "Test"]
git-tree-sha1 = "48c147e63431adbcee69bc40b04c3f0fec0a4982"
uuid = "b99e7846-7c00-51b0-8f62-c81ae34c0232"
version = "0.5.0"
[[CSV]]
call plug#begin('~/.config/nvim/plugged')
Plug 'morhetz/gruvbox'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'JuliaEditorSupport/julia-vim'
Plug 'cespare/vim-toml'
Plug 'tpope/vim-fugitive'
Plug 'ararslan/license-to-vim'
call plug#end()
const BYTES = fill(false, 128)
BYTES[Int(',')] = true
BYTES[Int('\n')] = true
BYTES[Int('\r')] = true
const COMMA = UInt8(',')
const NEWLINE = UInt8('\n')
const RETURN = UInt8('\r')
@quinnj
quinnj / gist:3ab5f31305d5f76056e2e7b79b2b58c3
Created October 10, 2017 03:16
Pure julia float parsing
const EXPONENTS = [
1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
1e20, 1e21, 1e22, 1e23, 1e24, 1e25, 1e26, 1e27, 1e28, 1e29,
1e30, 1e31, 1e32, 1e33, 1e34, 1e35, 1e36, 1e37, 1e38, 1e39,
1e40, 1e41, 1e42, 1e43, 1e44, 1e45, 1e46, 1e47, 1e48, 1e49,
1e50, 1e51, 1e52, 1e53, 1e54, 1e55, 1e56, 1e57, 1e58, 1e59,
1e60, 1e61, 1e62, 1e63, 1e64, 1e65, 1e66, 1e67, 1e68, 1e69,
1e70, 1e71, 1e72, 1e73, 1e74, 1e75, 1e76, 1e77, 1e78, 1e79,
1e80, 1e81, 1e82, 1e83, 1e84, 1e85, 1e86, 1e87, 1e88, 1e89,
"""
Base.selectorbytes(A::Array{T, N}) -> Array{UInt8, N}
For an Array with `isbits` Union elements, return the "selector bytes" that indicate the
index of the type for each array element, i.e. the type of `A[1]` is
`Base.uniontypes(eltype(A))[Base.selectorbytes(A)[1] + 1]`.
**NOTE**: The actual array selector bytes are returned, meaning if individual elements
are modified, the original array will reflect those changes. Setting selector bytes to
invalid or out-of-bounds type indexes may corrupt the original array.
"""
@quinnj
quinnj / iuab.jl
Last active July 21, 2017 03:24
isbits Union array benchmark
julia> function f(v::Vector{Int8}, n)
s = Int8(0)
@inbounds for i = 1:n
s += v[i]
end
return s
end
f (generic function with 2 methods)
julia> function f(v::Vector{Union{Void, Int8}}, n)
CC src/jltypes.o
In file included from support/libsupport.h:30:0,
from julia.h:8,
from jltypes.c:13:
support/utils.h:33:1: error: unknown type name 'STATIC_INLINE'
STATIC_INLINE u_int16_t ByteSwap16(u_int16_t x)
^
support/utils.h:33:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ByteSwap16'
STATIC_INLINE u_int16_t ByteSwap16(u_int16_t x)
^
{
"metadata": {
"language": "Julia",
"name": "Oklahoma Solar"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"metadata": {
"language": "Julia",
"name": "Max-maximum warning"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [