# Compile efficiency and argument-type declearation

**URL:** <https://discourse.julialang.org/t/compile-efficiency-and-argument-type-declearation/108464>\
**Category:** General Usage\
**Tags:** question\
**Created:** [January 7, 2024, 1:05pm UTC](https://discourse.julialang.org/t/compile-efficiency-and-argument-type-declearation/108464 "2024-01-07T13:05:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiang\_ming\_zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jiang_ming_zhang/32/204063_2.png) [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Post date:** [January 7, 2024, 1:05pm UTC](https://discourse.julialang.org/t/compile-efficiency-and-argument-type-declearation/108464/1 "2024-01-07T13:05:03Z")

</div>

Suppose I have a function defined as

```julia
function f(x,y)
    return x + y 
end 

```

Here I have no argument-type declearation. Does this mean julia has to generate as many methods as possible for this function in compiling?

If so, does this mean argument-type declearation will reduce the number of possible methods and thus enhance compile efficiency?

---

<div class="post-metadata">

**Author:** ![johnmyleswhite](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnmyleswhite/32/31_2.png) [@johnmyleswhite](https://discourse.julialang.org/u/johnmyleswhite)\
**Post date:** [January 7, 2024, 1:10pm UTC](https://discourse.julialang.org/t/compile-efficiency-and-argument-type-declearation/108464/2 "2024-01-07T13:10:16Z")

</div>

Julia only compiles a method when it sees, for the first time, a call to function with a new concrete type signature. In your example, it would compile `f(Int, Int)` if you run `f(1, 2)` for the first time ever. It will not compile anything else, so there is no compile time efficiency to be gained from having type declarations in your code.
