Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Mastering Julia

You're reading from  Mastering Julia

Product type Book
Published in Jul 2015
Publisher
ISBN-13 9781783553310
Pages 410 pages
Edition 1st Edition
Languages

Performance tips


Julia is quick, but poor coding can slow it down markedly. If you are developing enterprise software and/or distributing on GitHub, you need to pay more attention to some of the features and nuances of the language.

The online manual has a long section on performance tips, including a useful style guide and a section of frequently asked questions, which will prove to be illuminating. I've cherry-picked a few that I found of interest.

Best practice

First, a few points about variables, arrays, and types:

  • Global variables: These may change at different points, so it is hard for the compiler to optimize the code. Wherever possible, variables should be locally defined or passed to functions as arguments. If a variable is actually being used to store a value that does not change, this should be declared as const.

  • Changing a variable type: If you are accumulating a sum of floating point numbers, be careful to initialize the starting point for total as 0.0 and not 0, as the latter...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}