Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Cancel
4
  • 5
    Julia has tic() and toc() too... However, please do read the Julia Performance Tips docs.julialang.org/en/latest/manual/performance-tips/… ... The tl;dr is that you will be best off putting your computation inside of a function rather than doing everything at global scope, after which using @time will be simple. @time is also advantageous in that it reports memory allocation in addition to time. Commented Jul 20, 2015 at 20:50
  • 2
    I don't see why this deserved a down-vote (maybe the extraneous material in the "What I tried section?). Overly harsh. +1 back to 0. Also, I strongly second Isaiah's comment. 90% of the "Why is my Julia slow" questions occur because the author is working in global scope, ie did not wrap code inside a function. Commented Jul 20, 2015 at 23:53
  • @ColinTBowers I had actually received two downvotes. My guess is that cause was that the downvoters were upset that I did not just try tic() and toc(). I later added the "What I tried" section to explain why it was not obvious to me when I searched that the functions tic() and toc() actually exited in Julia. Commented Jul 21, 2015 at 2:18
  • Understood. A "What I tried" section is usually a good idea, and making it explicit like you have is even better. Of course, sometimes people can get a bit silly. I remember when this question was closed because it didn't initially contain a "what I have tried" section... Commented Jul 21, 2015 at 3:17