[JuliaLowering] Performance improvements (#61425)
Easy performance improvements from a bit of profiling, and some other
random cleanup.
## Main changes
- Make attribute storage `Dict{Symbol, Dict{NodeId, Any}}` instead of
`Dict{Symbol, Any}` so that tree.attr doesn't hit `getproperty(::Any,
::Symbol)`. The actual type of `tree.attr` is less well-known in some
cases, but it's not that common for JL to dispatch on that type
(in most cases we're checking it's `===` to something).
- I've added a few type assertions where we do dispatch on `tree.attr`.
- Removed `freeze`/`unfreeze_attrs`, since since Dict-attributes no
longer remember the attr type, so freezing that is no longer useful.
Using a NamedTuple as attribute storage is still supported and tested.
- Made `SyntaxList` immutable again. I made this mutable a while ago
along with `SyntaxGraph` for compilation-time reasons, but the more
pressing issue now is too many allocations, and the effect on compilation
time isn't huge (graph is still mutable).
---------
Co-authored-by: Shuhei Kadowaki <aviatesk@gmail.com>