How can I tell if a compilation is happening?

If I have a type struct Foo{N} end and N is intended to be a value, do methods on Foo{N} where N get compiled for each value of N or each type? For example, if I have a function foo_stuff(f::Foo{N}) where {N} and I call it with a Foo{Int(6)}, a Foo{Int8(6)} and a Foo{Int(5)}, do I get two separately compiled versions or three?

You get 3. The parameter of a type is part of the type, so each different parameter value will be compiled differently. If you don’t want this, you probably don’t want to parametrize Foo on N.

1 Like

Thanks! That makes sense.