# Julia is Eight times Slower than Go on Numerical Scheme

**URL:** <https://discourse.julialang.org/t/julia-is-eight-times-slower-than-go-on-numerical-scheme/59383>\
**Category:** Performance\
**Created:** [April 16, 2021, 5:00am UTC](https://discourse.julialang.org/t/julia-is-eight-times-slower-than-go-on-numerical-scheme/59383 "2021-04-16T05:00:13Z")\
**Posts on this page:** 1\
**Showing post:** 29

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [April 16, 2021, 9:19pm UTC](https://discourse.julialang.org/t/julia-is-eight-times-slower-than-go-on-numerical-scheme/59383/29 "2021-04-16T21:19:51Z")

</div>

There’s an old issue to allow [type annotations on global variables](https://github.com/JuliaLang/julia/issues/964). This would be a great intro compiler project — not trivial by any means, but relatively straightforward. The right approach would need to be discussed with the compiler team, but I suspect the it would be to associate a type with each global binding and automatically insert a type check at each global assignment and teach the compiler that it can assume that the type of each global access has the associated type. An untyped global would then have type `Any`, so all globals would work the same way. Some subtleties for usability: you’ll want to at least allow redeclaring the same global with the same type so that code can be re-included interactively; you could also allow the type annotation to be made more restrictive since any code that’s already been generated with that assumption will still be correct; to be really fancy, one could add “back edges” from global binding types to methods that use those globals and increase the world age / invalidate those methods, which would allow arbitrary re-declaration of type globals at the cost of recompiling any methods that accessed the global.

---

_[View the full topic](https://discourse.julialang.org/t/julia-is-eight-times-slower-than-go-on-numerical-scheme/59383)._
