Why do global variables impact performance so badly?

Since N is a non const global it is possible for a value with a different type to get assigned to it. As a result Julia has to generate more generic code that is valid for potentially all types.

3 Likes