Skip to content

better calling convention for large numbers of arguments #44417

Open
@JeffBezanson

Description

Currently, we mostly map julia function arguments directly to LLVM arguments regardless of how many there are. That probably causes us to hit some pathological cases, since LLVM is not likely to care about or optimize handling 1000 arguments, since most front-ends do not generate that.

For example:

julia> fields = [:($(Symbol("var$i"))::Int) for i in 1:1000];

julia> @eval struct x
           $(fields...)
           end

julia> @time @eval x(fill(1,1000)...)
  0.482531 seconds (39.92 k allocations: 2.195 MiB, 99.91% compilation time)

... which goes down to 0.16 seconds with -O0. There may be multiple issues (for example there seems to be too much time in dead store elimination), but we should probably use an array for the tail of the argument list.

This is not exactly easy, but could be a good relatively small project for somebody who wants to get started on the compiler.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    compiler:codegenGeneration of LLVM IR and native codecompiler:latencyCompiler latencygood first issueIndicates a good issue for first-time contributors to Julia

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions