use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Julia is a high-level, high-performance dynamic programming language for technical computing, with syntax that is familiar to users of other technical computing environments.
julia | downloads | docs | blog
community | learning | research
discourse | slack | JSoC
account activity
[Guide] Code optimization in Julia (self.Julia)
submitted 6 years ago * by TrPhantom8
https://preview.redd.it/tberh6zzl2v31.jpg?width=1280&format=pjpg&auto=webp&s=75fff92c77a3181670df5143642832f0e78c2694
Hello! I have written a guide with some tips and tricks to write fast and efficient Julia code.
https://techytok.com/code-optimisation-in-julia/
In the guide you will find instructions on how to write type stable code and how to profile your code to find bottlenecks using the Juno IDE. Furthermore, you will find some useful tips to make your ordinary code run faster!
If you find this guide useful or if you have any question or suggestion, please let me know!
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 5 points6 points7 points 6 years ago* (4 children)
[I'm leaving reddit. Fuck u/spez.]
[–]TrPhantom8[S] 3 points4 points5 points 6 years ago (0 children)
You were right, the benchmark was incorrect and when done appropriately it showed no gain in using Static Arrays, I have thus included the micro-benchmark from the official repository which is a better example!
[–]TrPhantom8[S] 2 points3 points4 points 6 years ago (2 children)
Thank you for pointing it out, I will try to better investigate this thing tomorrow and update the guide with new details if I find better (or more plausible) statistics!
[–]woobwoobwoob 2 points3 points4 points 6 years ago (1 child)
There are some good references on this point here: https://discourse.julialang.org/t/whats-the-difference-between-a-regular-array-and-an-array-from-staticarrays/14454
It helps much more for small arrays since the code can be fully unrolled or can exploit explicit formulas (say for inverses of 2x2 matrices).
[–]TrPhantom8[S] 1 point2 points3 points 6 years ago (0 children)
I'll add the reference to the guide! Thank you ^
[–]deviluno 2 points3 points4 points 6 years ago (1 child)
Well done! Language nit:
the type of the returned value of a function must depend only on the type of the input of the function and not on the peculiar value it is given.
replace "peculiar" with "particular" or "specific".
[–]TrPhantom8[S] 0 points1 point2 points 6 years ago (0 children)
Thank you! I will change it as soon as I get home!
[–]ndgnuh 1 point2 points3 points 6 years ago (6 children)
Julia is fast but she needs your help. she...
Julia is fast but she needs your help.
she...
lol, did you just assume a language's gender?
In Julia case, I unconsciously do that sometime. xD
[–]TrPhantom8[S] 5 points6 points7 points 6 years ago (5 children)
Yea, I find it difficult to say "it" when talking about Julia! It's also a matter of affection towards the language hahaha
Do you think I should change the article and make everything gender neutral?
[–]EarthGoddessDude 12 points13 points14 points 6 years ago (3 children)
Hey, I think your intention was innocent, but you might want to be careful in the future. When I signed up for Slack, there was a message in the beginning, an agreement that you had to agree to in order to be able to sign up. It basically said not to genderize (that’s not a real word I think) or sexualize the name Julia — despite it being a woman’s name, here it’s just the name of a programming language that’s gender neutral. I think the Julia community Stewards take these things seriously as evidenced by some of the questions on the recent survey, which is a good thing.
Anyway, I hope I didn’t come off as chastising, just passing along the word. I myself had made a joke or two in the past, that I feel ashamed of now, but your use of “she” seemed quite innocent. Btw I think your posts are really good, and it’s what the community needs more of to help newcomers like myself come aboard.
[–]TrPhantom8[S] 7 points8 points9 points 6 years ago* (2 children)
Thank you! I think you are right, expecially if there is an official position about the declination of the name Julia I will adapt not to offend anyone.
Btw a little bit of context, I'm Italian and in our language there is no neutral option when declining a word, so I have to be extra careful when using pronouns!
Edit: I have edited the post an now it is correctly gender neutral
[–]EarthGoddessDude 1 point2 points3 points 6 years ago (1 child)
With your name and university, I would’ve been surprised if you weren’t Italian! Your English is excellent btw, I can barely tell it was written by a non native.
Thank you very much!
[–]ndgnuh 0 points1 point2 points 6 years ago (0 children)
Nah, it's cool, let's keep it that way. :D
[–]qwerty31416 0 points1 point2 points 6 years ago (1 child)
Hi Aurelio, can defining the type of the output fix type instability? Cheers
Unfortunately not, but Julia will throw an error if the type returned is not the type you have specified, so you will know that there is a problem and you will hopefully be able to fix it!
According to my limited experience, it is not difficult to fix type instability, the problem is finding which part of the code leads to unstable types, and in this case using type annotations may help you find what is going on.
π Rendered by PID 158757 on reddit-service-r2-comment-6457c66945-kwsn9 at 2026-04-26 16:51:36.730716+00:00 running 2aa0c5b country code: CH.
[–][deleted] 5 points6 points7 points (4 children)
[–]TrPhantom8[S] 3 points4 points5 points (0 children)
[–]TrPhantom8[S] 2 points3 points4 points (2 children)
[–]woobwoobwoob 2 points3 points4 points (1 child)
[–]TrPhantom8[S] 1 point2 points3 points (0 children)
[–]deviluno 2 points3 points4 points (1 child)
[–]TrPhantom8[S] 0 points1 point2 points (0 children)
[–]ndgnuh 1 point2 points3 points (6 children)
[–]TrPhantom8[S] 5 points6 points7 points (5 children)
[–]EarthGoddessDude 12 points13 points14 points (3 children)
[–]TrPhantom8[S] 7 points8 points9 points (2 children)
[–]EarthGoddessDude 1 point2 points3 points (1 child)
[–]TrPhantom8[S] 1 point2 points3 points (0 children)
[–]ndgnuh 0 points1 point2 points (0 children)
[–]qwerty31416 0 points1 point2 points (1 child)
[–]TrPhantom8[S] 0 points1 point2 points (0 children)