Code Monkey home page Code Monkey logo

Comments (8)

YuriGor avatar YuriGor commented on August 27, 2024 1

Ok, I will review it tonight.
Thank you for contribution!

from deepdash.

YuriGor avatar YuriGor commented on August 27, 2024

Hi!
I'll think about 1. - sounds good
2. is already implemented, take a look at childrenPath option
3. I'll take a look, thank you for idea. Hope transpiler will generate clean enough code for spread.

from deepdash.

raz-sinay avatar raz-sinay commented on August 27, 2024

Thanks for the quick response!
About suggestion 2, the childrenPath specifies what paths will be sent to the user's callbacks, but the iteration process scans all paths, while it can just scan by the paths the user specified (as far as I've seen, if I'm wrong please tell me how to use it properly to reduce scan time)

from deepdash.

YuriGor avatar YuriGor commented on August 27, 2024

If childrenPath is specified - deepdash doesn't visit other paths.
If you see it's not so in some cases - let me know, it's a bug.
At getIterate.js look at :97 (children only case) and :105 (full scan case)

from deepdash.

raz-sinay avatar raz-sinay commented on August 27, 2024

the thing is, filterDeep uses condenseDeep (if the condense flag wasn't set to false) , which uses eachDeep.
(filterDeep ==> condenseDeep ==> eachDeep)
when condenseDeep calls eachDeep, it doesn't supply the entire options object that the user specified in the filterDeep call, but only part of it :
var eachDeepOptions = { checkCircular: options.checkCircular, };
this causes a full scan.

moreover, I've replaced the concat with spread, which did result in a big performance improvement. as can be seen here:
image
I forked the repository to submit a pull request, but unfortunately, as you said, the transpiler turned it back to concat. Are there configurations that can be made? I've never used this transpiler before.

from deepdash.

YuriGor avatar YuriGor commented on August 27, 2024

Maybe it's a good idea to extend options to let user collapse only holes caused by filtration, and keep other empty slots untouched.

It's a pretty complicated way - I will need to remember paths rejected by a filtration process,
check each level in the path if it's the beginning or middle of some array and, instead of total deep condensing, surgically collapse specific holes, considering each array could have other holes originally or left by another rejected path.

In case some array has multiple holes left by several rejected paths - it will be a pain to recalculate
shifted indexes on each collapsed hole, to keep rest of remembered rejected paths correct.

As a dirty alternative - I can remember not a paths rejected by a filter, but only arrays affected by such rejection. And after filtering process is done - just condense all these arrays.
In this case, some originally existing holes will be collapsed too, but some - will not. So this case is good only for an initially condensed object.
Yeah, I think it will be good enough to give the user a choice:

  • don't condense result at all (so user will be able to use condenseDeep explicitly if he needs)
  • 'dirty' condense only affected arrays and gain some performance - in case of initially condensed data this option will work perfectly.

About spread / concat - there is a separate deepdash-es module - it's not transpiled.
Please don't hurry with a PR for now - there are upcoming changes in the lib build process I want to finalize first.

from deepdash.

raz-sinay avatar raz-sinay commented on August 27, 2024

Actually, after I've seen the performance results of using spread instead of concat, maybe adding the other 2 options that we have discussed are overhead, because the improvement is quite big by itself.
I do think the change in deepdash-es is important and it's really quick with no side effects. I made the PR there , under es/private/getIterate.js. (hope that's what you meant).
it's really important for my usage.
This is the PR #34 .

Thanks for the quick response and discussion!

from deepdash.

YuriGor avatar YuriGor commented on August 27, 2024

Merged and published as v4.2.14
Please test and put a star if everything still works 😉

from deepdash.

Related Issues (20)

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.