With master:
julia> code_native(Base.sum_seq, (Vector{Float64}, Int, Int))
.text
Filename: reduce.jl
Source line: 226
push RBP
mov RBP, RSP
Source line: 226
|-------|----------------------|------------------|------------|-------------|-------------|-----------------|-----------------| | |
| Row # | proc | (nsamples,ncoef) | time_julia | time_matlab | time_octave | matlab_relative | octave_relative | | |
| 1 | "filt SOSFilter" | (256,2) | 0.00210658 | 0.0901177 | 0.00722314 | 42.7792 | 3.42885 | | |
| 2 | "filt SOSFilter" | (256,4) | 0.00258519 | 0.0925957 | 0.00938837 | 35.8177 | 3.63159 | | |
| 3 | "filt SOSFilter" | (256,8) | 0.00363507 | 0.0985003 | 0.0133466 | 27.0972 | 3.67161 | | |
| 4 | "filt SOSFilter" | (256,16) | 0.00600978 | 0.109797 | 0.0212647 | 18.2697 | 3.53835 | | |
| 5 | "filt SOSFilter" | (1024,2) | 0.00705921 | 0.0935538 | 0.0125278 | 13.2527 | 1.77467 | | |
| 6 | "filt SOSFilter" | (1024,4) | 0.00867183 | 0.0966722 | 0.0192736 | 11.1478 | 2.22256 |
using Base.Cartesian, Base.Test | |
using Base: check_reducdims, evaluate, @get!, mapreducedim! | |
function gen_mapreducedim_function(nd::Int, narrays::Int) | |
As = [symbol("A_"*string(i)) for i = 1:narrays] | |
@eval begin | |
local _F_ | |
function _F_(f, op, R, $(As...)) | |
@nextract $nd sz d->($(narrays > 1 ? :(@ncall $narrays max k->size(A_k, d)) : :(size(A_1, d)))) | |
@nloops($nd, i, d->1:sz_d, |
function test(n) | |
a = 0 | |
b = 0 | |
aulpdiff = Array(Float64, n) | |
bulpdiff = Array(Float64, n) | |
for i = 1:n | |
x = rand() | |
r1 = (x*x)*(x*x) | |
r2 = x^4 | |
bigres = big(x)^4 |
using DSP | |
N=1024*32; | |
x0=rand(N); | |
nn=div(N,8); | |
mm=div(N,16); | |
println("welch_pgram") | |
f(x0, nn, mm) = for i = 1:1000; power(Periodogramt(x0,n=nn,noverlap=mm,twosided=true,window=false)); end | |
f(x0, nn, mm); | |
@time f(x0, nn, mm); |
julia> (+)(A::AbstractArray{Bool},x::Bool) = A .+ x | |
Warning: New definition | |
+(AbstractArray{Bool,N},Bool) at none:1 | |
is ambiguous with: | |
+(Range{T},Real) at range.jl:428. | |
To fix, define | |
+(Range{Bool},Bool) | |
before the new definition. | |
Warning: New definition | |
+(AbstractArray{Bool,N},Bool) at none:1 |
With master:
julia> code_native(Base.sum_seq, (Vector{Float64}, Int, Int))
.text
Filename: reduce.jl
Source line: 226
push RBP
mov RBP, RSP
Source line: 226
import Base: unique, hash | |
immutable Prehashed | |
hash::Uint | |
end | |
hash(x::Prehashed) = x.hash | |
function unique{T}(A::AbstractArray{T,2}, dim::Int) | |
hashes = zeros(Uint, size(A, 1)) |
import Base.length | |
immutable MyOrdinalValue12 | |
index::Uint8 | |
pool::Vector{ASCIIString} | |
end | |
immutable MyPooledDataArray1 | |
index::Vector{Uint8} | |
pool::Vector{ASCIIString} |
flatten_dot(s::Symbol) = (s,) | |
flatten_dot(ex::Expr) = tuple(flatten_dot(ex.args[1])..., ex.args[2].args[1]) | |
macro reexport(syms...) | |
if length(syms) == 1 && isa(syms[1], Expr) && syms[1].head != :. | |
syms[1].head == :tuple || error("@reexport: invalid syntax") | |
syms = syms[1].args | |
end | |
modules = (Symbol...)[begin | |
if isa(arg, Symbol) || (isa(arg, Expr) && arg.head == :.) |
julia> function gtindex{T}(parent::Array{T,2}, sz1::Int, sz2::Int, first_index::Int, strd1::Int, strd2::Int, ind::Int) | |
ind -= 1 | |
i2 = div(ind,sz1) | |
i1 = ind-i2*sz1 | |
@inbounds ret = parent[first_index + i1*strd1 + i2*strd2] | |
ret | |
end; | |
julia> code_native(gtindex, (Array{Int, 2}, Int, Int, Int, Int, Int, Int)) | |
.text |