"contextless" is just a linting thing or it affects optimizations?

Is the compiler doing static analysis to figure out when to pass a context? or it is required to manually mark procs as “contextless”?

I’m making a lot of my procs as “contextless” and i’d rather not, since it uglify my code, i’d rather let the compiler figure it out

I’m i overthinking this? anyone ran benchmarks?

The "contextless" calling convention is the same as the default "odin" calling convention but it just doesn’t pass that implicit context pointer.

This means you get the benefits of the "odin" calling convention in places where the context does not exist e.g. foreign code using things like "c" or "system" calling conventions.

Performance-wise though, they should be pretty similar in practice.

But why not let the compiler figure that out?

Because the compiler CANNOT figure it out. It’s metaphysically impossible since it cannot know your intent.

I’m only referring to "contextless" btw, compiler knows if a leaf procs will touch the context or not

main :: proc() {
    result := add(1,2)
}

add :: proc(a: i32, b: i32) -> i32 {
    return a + b
}

My question was specially for such case, should i bother marking it "contextless" or will the compiler optimize that out anyways

You haven’t answered that

The compiler can optimize that out in most cases when optimizations are applied.

Only use "contextless" when you know you need to use it.