module aliases and efficiency

97 views
Skip to first unread message

Tamas Papp

unread,
Apr 23, 2015, 4:40:06 AM4/23/15
to juli...@googlegroups.com
Reading through the issues and the mailing list (eg [1]), I came across
a technique for aliasing long module names when I don't want to use
`using`, eg

--8<---------------cut here---------------start------------->8---
module MySuperLongModuleName
f() = 42
end

module Foo
import MySuperLongModuleName
M=MySuperLongModuleName
test() = M.f()
end
--8<---------------cut here---------------end--------------->8---

However, I think that the resolution of M.f() happens at runtime, which
will prevent Julia from inlining the function --- is this the case?
Would this affect efficiency? Is there a workaround?

Best,

Tamas

[1] https://github.com/JuliaLang/julia/issues/1255

Jameson Nash

unread,
Apr 23, 2015, 7:28:00 AM4/23/15
to juli...@googlegroups.com
The general workaround for any question about the performance of globals is to stick `const` in front. I don't see why that shouldn't work here too.
Reply all
Reply to author
Forward
0 new messages