Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Over specialization on function argument #15190

Closed
yuyichao opened this issue Feb 22, 2016 · 2 comments
Closed

Over specialization on function argument #15190

yuyichao opened this issue Feb 22, 2016 · 2 comments
Assignees
Labels
compiler:latency Compiler latency regression Regression in behavior compared to a previous version

Comments

@yuyichao
Copy link
Contributor

Ref #15177 (comment)
On my laptop, the following code takes < 0.02s on 0.4 and > 40s on master.

function f(m)
    for i in names(m)
        v = m.(i)
        isa(v, Function) && string(v)
    end
end
@time f(Base)

According to the profiling result, it spends most of the time in inferencing and compiling string (or print_to_string) even though the result of the compilation isn't any useful since rerunning f(Base) takes roughly the same time on 0.4....

As Stefan pointed out, the heuristic of not specializing on what we don't call should solve this issue but somehow it is not triggerred in this case.

@jrevels for performance benchmark. In additional to the reduced case above, the first half of genstdlib.jl script before #15177 should be a good candidate too.

c.c. @JeffBezanson

@yuyichao yuyichao added performance Must go faster regression Regression in behavior compared to a previous version labels Feb 22, 2016
@jrevels jrevels added the potential benchmark Could make a good benchmark in BaseBenchmarks label Feb 23, 2016
@carnaval
Copy link
Contributor

carnaval commented Mar 1, 2016

@JeffBezanson the problem here is MAX_UNSPECIALIZED_CONFLICTS, so even though the logic for "this argument is or is not being called in this function" is correct, it gives up on unspecializing the cache entry

@JeffBezanson
Copy link
Member

Ok, let's bump it to 20.

My job is so easy :)

@JeffBezanson JeffBezanson self-assigned this Mar 12, 2016
@KristofferC KristofferC added compiler:latency Compiler latency and removed potential benchmark Could make a good benchmark in BaseBenchmarks performance Must go faster labels Oct 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:latency Compiler latency regression Regression in behavior compared to a previous version
Projects
None yet
Development

No branches or pull requests

5 participants