Coder Social home page Coder Social logo

Comments (4)

jfsiii avatar jfsiii commented on July 21, 2024

I am glad to look into this, but am not familiar with the various valid forms of values that should be supported.

If you publish tests showing some examples, I can take a crack at tuning the function.

from json-stat.

jfsiii avatar jfsiii commented on July 21, 2024

Here are two screenshots from the trace.

screen shot 2017-05-29 at 9 44 56 pm

screen shot 2017-05-29 at 9 46 25 pm

The code I'm profiling is

const merged = JSONstatUtils.join(datasets, { by: 'date', label: meta.label });

where datasets is an array of 30 entries like the one in the issue description.

Note that there are 50 calls to toTable and many of the calls are 100-200ms

from json-stat.

badosa avatar badosa commented on July 21, 2024

@jfsiii Thank you very much for looking into this. For generalization's sake, join relies on toTable and fromTable. So yes, in a dataset join by dimension (like your example) you need at least as many toTable as datasets (in your example, 30 datasets of around 800 values each: total 24000 values).

That might not be the most efficient solution but it's probably one of the simplest ones because normalization is taken care by toTable.

The issue can be tried to be solved using a different approach (avoiding toTable altogether) or improving toTable. The first solution requires modifying JJUS, the second, JJT. Something that has to be taken into account is that JJT was born many years ago and was originally designed to be compatible with very old browsers with no suport for ES5, which explains why the use of the "new" array methods (Array.indexOf, Array.forEach, Array.filter, Array.map, etc.) was included very recently (and very sparingly). Which means there might be room for improvement in JJT too.

I am glad to look into this, but am not familiar with the various valid forms of values that should be supported.

I understand the second solution does not require this familiarity. And, in the first one, the various valid forms can be avoided if instead of dealing with the original objects you deal with the jsonstat instance produced by JSONstat() using the JJT methods. This last approach seems preferable to make sure the solution is forward compatible with future additions.

The official samples are available here:

https://json-stat.org/samples/

I hope this helps. Please let me know if you need more information.

from json-stat.

badosa avatar badosa commented on July 21, 2024

Issue closed because repository has been frozen (new version is at https://github.com/jsonstat/toolkit).

from json-stat.

Related Issues (15)

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.