Skip to content

optimizations #69

@jonschlinkert

Description

@jonschlinkert

I'd like to propose some optimizations that I would also be happy to implement after pr #67 is resolved.

In particular, I think if path caching, lazy-caching and getters/setters are implemented throughout the code it would result in pretty noticeable performance improvements. Just as importantly we can do so without complicating the code (it might even make the code cleaner).

Why?

  • lazy-caching: will result in faster initialization and application loading (potentially dramatically faster)
  • getters/setters: will result in better performance with path calculations and building up the config/env objects after initialization.
  • caching: will result in faster lookups in cases where the same information is requested more than once

Also, I implemented similar optimizations in verb and assemble and it reduced init time from 500-800 ms, to 150-200 ms. This makes the experience a lot nicer, and since init is faster it opens up the door for more interesting things (that might typically bog down the experience too much).

lazy-caching

Since liftoff is a command line application, it's a perfect use case for lazily evaluating requires. This way only libraries that are actually needed with be loaded upon invocation.

(fwiw, I've seen some developers have philosophical issues with this, but we use lazy-caching quite extensively and after 30+ million downloads of lazy-cache, we've had only one real issue related to webpack. And that was resolved months ago. Being a command line app, this would never be an issue here anyway)

Getters/setters

Anywhere an object is built up and paths are process, we have an opportunity to use getters/setters to evaluate and set the paths - similar to vinyl.

This way as the config/env is built up, whenever possible we would delay any path processing until it's needed.

Caching

This one probably wouldn't have much impact unless liftoff was used throughout the application lifecycle.
We would keep a cache of directories and files, and then whenever possible reuse the cached information instead of hitting the file system again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions