Book Image

Lo-Dash Essentials

By : Adam Boduch
Book Image

Lo-Dash Essentials

By: Adam Boduch

Overview of this book

Table of Contents (15 chapters)
Lo-Dash Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Summary


In this chapter, we introduced some of the influences that guide the design and implementation of Lo-Dash. Earlier versions of the library opted for function compilation, building the functions on the fly to best handle performance and other variations from environment to environment. Recent versions have traded this approach for common base functions. Function compilation avoided some of the indirection associated with base functions. However, modern browsers have a JIT optimizer. It is better able to optimize base functions. Besides, the code is much more readable with base functions.

The golden rule of the implementation of Lo-Dash is optimization for the common case. You'll see this rule in action all over Lo-Dash, and it is the key factor in its superior performance. In any given function, the most common case is heavily optimized first, pushing the uncommon cases towards the end of the function. Callbacks are used everywhere in Lo-Dash, so it's important that they're able to...