Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Web Development with Julia and Genie

You're reading from   Web Development with Julia and Genie A hands-on guide to high-performance server-side web development with the Julia programming language

Arrow left icon
Product type Paperback
Published in Nov 2022
Publisher Packt
ISBN-13 9781801811132
Length 254 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Ivo Balbaert Ivo Balbaert
Author Profile Icon Ivo Balbaert
Ivo Balbaert
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Part 1: Developing Web Apps with Julia
2. Chapter 1: Julia Programming Overview FREE CHAPTER 3. Chapter 2: Using Julia Standard Web Packages 4. Chapter 3: Applying Julia in Various Use Cases on the Web 5. Part 2: Using the Genie Rapid Web Development Framework
6. Chapter 4: Building an MVC ToDo App 7. Chapter 5: Adding a REST API 8. Chapter 6: Deploying Genie Apps in Production 9. Chapter 7: Adding Authentication to Our App 10. Chapter 8: Developing Interactive Data Dashboards with Genie 11. Index 12. Other Books You May Enjoy

How Julia works

After this whirlwind tour of Julia, we want to see why Julia is a good fit for the web world. To do that, we must have a good understanding of Julia’s internal workings.

The Julia JIT compiler works at runtime, starting from the Julia source code. Note that code from packages is most often precompiled. Type, method, and module definitions are written in an efficient serialized form so that the JIT can start compiling much faster. The first time a function is called with a certain combination of types of arguments, the correct machine code for those types is generated through LLVM. Moreover, the machine code is cached from then on, so after the initial compilation stage, the optimized code is looked up in the function’s vtable (see Types, flow controls, and functions), and you get the bonus of much-improved performance.

Julia apps will often be long-running processes, so there needs to be a mechanism for freeing memory resources. The Julia developer, however, is not burdened with this task. Julia has a garbage collector process. This is a simple mark-and-sweep GC causing low overhead. The best advice here is as follows:

  • Avoid unnecessary memory allocations
  • Use standard-library methods that modify variables (whose name ends with !, for example, sort!) instead of creating new ones
  • Use immutable objects (const and struct)
  • Pre-allocate enough memory from the start to avoid GC altogether

Now that we know somewhat better how Julia works, we can argue why Julia can be used for web development.

You have been reading a chapter from
Web Development with Julia and Genie
Published in: Nov 2022
Publisher: Packt
ISBN-13: 9781801811132
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 $19.99/month. Cancel anytime
Banner background image