Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhead in pull-attr-datoms #221

Open
wants to merge 1 commit into
base: master
from
Open

Overhead in pull-attr-datoms #221

wants to merge 1 commit into from

Conversation

@gersak
Copy link

@gersak gersak commented May 8, 2017

Hi,

For one of our projects we are using Datascript in combination with Om/next for rendering our frontend. Using DB on frontend is really nice for rendering DOM elements. We are working with quite big datasets on frontend that have alot of relations between them.

As our project grows dataset is getting larger and larger and we are pulling more and more data for rendering. IE. in one part of application we are pulling about 520 entites that represent user tasks. Each of this task is linked to a project and to the person that assinged task, group and so on... So we have about 3-5 references to other entities.

This pull takes about ~0.5-7 seconds and feels slowish.

--
When going through dev tools in Chrome we've noticed that clojure.core/into is taking alot of "Total Time" when calling datascript.core/pull so we've modified datascript.pull-api/pull-attr-datoms to see what will happen.

Results are that execution time was cut down for ~100-150 ms.

Can you please check out changes and comment?

Tnx


This change is Reviewable

@gersak

This comment has been minimized.

Copy link
Owner Author

@gersak gersak commented on src/datascript/pull_api.cljc in ed87aa9 May 8, 2017

No point in constructing a vector through transducer if the end goal is to see if something is found or not. This will always resolve since default value is +default-limit+

Since this function is part of recursive algorithm and is called alot imo this brings alot of overhead

@gersak

This comment has been minimized.

Copy link
Owner Author

@gersak gersak commented on src/datascript/pull_api.cljc in ed87aa9 May 8, 2017

Same goes for the code below. Is there a point in using cond-> and cond->> if single condition is tested? As well as construcing new vector...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.