Lazy Loading

noun

say it: “LAY-zee LOH-ding” /ˈleɪzi ˈloʊdɪŋ/

Leaving an expensive object unmade until the first time someone asks for it, then making it once and keeping it for the next time.

What is lazy loading?

Lazy loading leaves an expensive object unmade until someone first asks for it, then makes it once and keeps it. A seat map loads the photo of a section's view only when a fan taps that section.

from functools import cached_property


class SectionView:
    @cached_property
    def photo(self):
        print("loading")
        return "the view from section 112"


view = SectionView()
print(view.photo, view.photo)  # loading, then the photo twice

In a sentence

  • “With lazy loading, the seat map opens at once and loads a section's photo only when a fan taps it.”

Level: Journeyman · More Software Development terms at this level

Updated

In other subjects