johnmyleswhite / Benchmarks.jl

A new benchmarking library for Julia
Other
45 stars 15 forks source link

Allow functions with keyword arguments #33

Closed mbauman closed 8 years ago

mbauman commented 9 years ago

Unfortunately this fix breaks benchmarking indexing assignments because calling expand on a keyword function call does all sorts of crazy things to the AST. I suppose we could handle it, but it is really messy. I suppose I'm okay giving up @benchmark A[I].

Fixes #32.

johnmyleswhite commented 9 years ago

Great work.

TBH, this example is starting to make me a little worried that we're playing the "what edge case have I still forgotten game" that I've played with macros for NA In DataArrays. Is indexing really the only thing we're losing?

jiahao commented 9 years ago

Works for my use case in IterativeSolvers.

(This version no longer works as posted because b_ata = @benchmark B = m≥n ? A*A' : A'A is no longer supported on master. The replacement code is

    makeata(A) = (size(A, 1) ≥ size(A,2) ? A*A' : A'A)
    B = makeata(A)
    b_ata = @benchmark makeata(A)

which is rather annoying, but works.)

mbauman commented 9 years ago

Yeah, it's frustrating. expand also handles setindex and macrocalls... and maybe a few other things too. But expand(:(svds(A, nsv=3))) is so ridiculously complicated that I don't want to deal with it. I suppose we could try to expand it only if it's not already a function call.

mbauman commented 9 years ago

Alright, after thinking through this a bit more, I think it's ok to conditionally call expand. I've also added very basic regression tests that start enforcing the cases we support.

aviks commented 8 years ago

Bump. I just hit this and came looking.