Do you mean across a module? If so, it’s simply this:
module MyPackage
const boltzmann_constant = 1.380649e-23 # joules per kelvin
# The rest of the package code
end
Maximum performance is guaranteed, in the sense that whenever you type boltzmann_constant in the rest of the module, the performance is indistinguishable from literally typing 1.380649e-23 again.
Well, your initial question was where to put constants - to my understanding, as long as they are defined as const, that doesn’t really matter. Defining them on your own in a separate module, or in each module, or importing them from one of the specialized packages - all that is fine.
Another question was whether your work with “naked” or unitful numbers. For myself it wouldn’t be a question: Since I learned Unitful.jl, I’d never start a physical calculation with “naked” numbers. First, because I can use the data exactly in the units they were measured in - be it °C, Torr, or whatever. Second, because using unitful values helps me catch a substantial proportion of errors.
Now, whether Unitful.jl or DynamicQuantities.jl (or none). The second one is a younger package and I never used it yet. Unitful.jl can cause substantial overhead in certain circumstances, and was in my experience incompatible with some differential equations package (in which case I made all preliminary calculations with unitful values, then converted them to SI using upreferred, and then stripped units before passing them further). DynamicQuantities.jl. might be more compatible.
Now, what’s better for you? - try it, or tell us more about your problem.