Skip to content

Local Storage Optimization #841

Open

Description

@marcguyer

I've noticed that the data inserted in local storage is almost 6x the size of the original data set. For a 50k data set, the local storage data is 291k in my tests. This could be quickly reduced by changing the "children" key to something smaller as others have suggested for optimizing the post-processed data. Further, I don't presume to understand how the "trie" is built/used/etc, but on the surface it appears to contain some redundancy that could be avoided.

Perhaps I could take a look at improving this myself with just a bit of guidance based on your institutional knowledge.

Activity

  1. jharding commented on Jul 9, 2014

    @jharding
    Contributor

    Related to #845. The reason it's so large is because when the prefetch data is loaded, it's processed into a trie for quick lookups. It's debatable whether this is necessary.

  2. added this to the v1.0.0 milestone on Aug 19, 2014
  3. browles commented on Sep 13, 2014

    @browles

    The current trie implementation gives very quick lookups at a unnecessarily large cost to memory. One problem is that ids are pushed to the .ids array of every node corresponding to the letters of the token; this could be changed to store the ids only at the node of the terminal token letter. Autocomplete matching could be then changed to: traverse down the trie via the letters of the input partial word, and retrieve all ids below that node. This would slow lookups slightly, but each id would only be stored once instead of at numerous nodes.

    We could furthermore make the .ids property undefined until there were an id to push, giving marginal savings on space. Additionally the .children property ought to be renamed to a one or two character name, .ch or something.

    If that sounds alright, I'm going to start working on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions