JuliaDiff / JuliaDiff/Diffractor.jl

Very poor performance on simple taylor function

Open
#113 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
453
Forks
33
PR merge metrics
No merged PRs in 30d

Description

In Chris' recent SciML video, at this timestamp he showcases a little AD benchmark. Summarizing, differentiating the function:

function taylor(x, N)
    sum = 0 * x
    for i = 1:N
        sum += x^i / i
    end
    return sum
end

Shows pretty poor performance in Diffractor. I've created a gist that contains a Project, Manifest and test script to showcase the issue. You can increase N to get harder and harder problems. Note that I was unable to get Enzyme working on master (perhaps I need to check out the master branch) and Diffractor dies with a stack overflow if N is too large.

For N=10^4, we get timings of Enzyme's code running in <1ms, and Diffractor taking more than 300ms. Zygote and ForwardDiff are both well under 10ms.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked gist's Project, Manifest, and test script, and run the Taylor benchmark with N=10^4. Compare Diffractor's timing and stack behavior with the Enzyme, Zygote, and ForwardDiff results described in the issue. Done means the benchmark no longer shows the reported severe slowdown or stack overflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.