Giter VIP home page Giter VIP logo

csvzip's Issues

Possible performance improvement

Love the idea.

Just a quick suggestion. In the example you end up with a JSON mapping like

{
  "census": {
    "DESC_DISTRITO": {
      "CENTRO": "0",
      "ARGANZUELA": "1",
      "RETIRO": "2",
      "SALAMANCA": "3",
      ...
    },
    "DESC_BARRIO": {
      "PALACIO": "0",
      "EMBAJADORES": "1",
      "UNIVERSIDAD": "2",
      "CHOPERA": "3",
      "PACIFICO": "4",
      ...
    }
  }
}

If I were using this I'd probably generate a lookup table for each key of census, so any lookups would be one operation, instead of traversing object keys and checking the values for a match.

Basically, flip them this way.

{
  "census": {
    "DESC_DISTRITO": {
      "0": "CENTRO",
      "1": "ARGANZUELA",
      ...
    },
...
}

Let's say we're looping over the rows, or we're looking at the info for a single row.

const row = "139,1".split(','); // Fake row with two columns 

This would always be fast

const name = mapping['census']['DESC_DISTRITO'][row[1]];

With the current mapping, lookups would get slower with the number of keys in the DESC_DISTRITO object

Maybe I'm overlooking/missing something.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.