Comments (4)
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.
Here are two screenshots from the trace.
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.
@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.
Issue closed because repository has been frozen (new version is at https://github.com/jsonstat/toolkit).
from json-stat.
Related Issues (15)
- Register JSON-stat in the Bower registry
- Updated examples HOT 2
- Publish JJUS to npm HOT 4
- Collection of Dataset without "href" element hangs HOT 3
- Problem converting json-stat to table HOT 9
- JSONstat() returns multiple datasets HOT 1
- How to have metadata for values HOT 1
- Optional "unit" is mandatory for "metric" dimensions in JSON_stat Explorer HOT 3
- slice: how to query on multiple values ? HOT 1
- some doubts HOT 1
- status fiels required HOT 2
- How to write json-stat? HOT 3
- Dimension response support HOT 2
- JSONstat() HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-stat.