logreg
logreg copied to clipboard
Add {Manifest, Project}.toml and optimize `fit-bayes.jl`
To have fast code in Julia, we need to make sure that the code is type stable. In addition to make the code type stable (avoid creating closures over global variables), I also added a buffer to minimize allocations and used LoopVectorization to accelerate log evaluation.
Before:
113.925800 seconds (350.11 M allocations: 112.508 GiB, 21.51% gc time, 0.01% compilation time)
Now:
7.521123 seconds (10.00 M allocations: 1.193 GiB, 3.59% gc time)
I add *.toml files so that one can just active the project and run the scripts. This addresses the issue mentioned in README.md:
The Julia examples depend only on standard packages which are part of the Julia package ecosystem, and are therefore easy to add, in principle. But in my limited experience, package dependency conflicts are even more of a problem in Julia than they are in Python, and that's saying something.
But in my limited experience, package dependency conflicts are even more of a problem in Julia than they are in Python, and that's saying something.
FWIW, I tend to have separate projects for everything I do. Not bringing in things I don't need means most version conflicts I face are in the repos I maintain and the result of breaking changes.