Abstract
In this chapter, we examine another optimization pattern, the flyweight. It’s most useful in situations where large numbers of similar objects are created, causing performance problems. This pattern is especially useful in JavaScript, where complex code can quickly use up all of the available browser memory. By converting many independent objects into a few shared objects, you can reduce the amount of resources needed to run web applications. The benefit of this can vary widely. For large applications that can potentially be used for days at a time without being reloaded, any technique that reduces the amount of memory used can have a very positive effect. For small pages that won’t stay open in the browser for that long, memory conservation isn’t as important.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Rights and permissions
Copyright information
© 2008 Ross Harmes and Dustin Diaz
About this chapter
Cite this chapter
(2008). The Flyweight Pattern. In: Pro JavaScript Design Patterns. Apress. https://doi.org/10.1007/978-1-4302-0496-1_13
Download citation
DOI: https://doi.org/10.1007/978-1-4302-0496-1_13
Publisher Name: Apress
Print ISBN: 978-1-59059-908-2
Online ISBN: 978-1-4302-0496-1
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books