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

perf: Reduce the impact of 'QueryRenderChild.isFilenameUnique()' on rendering speed #2735

Open
claremacrae opened this issue Mar 25, 2024 · 2 comments
Assignees
Labels
scope: performance issues Issues with speed or responsiveness type: internal Only regards development or contributing

Comments

@claremacrae
Copy link
Collaborator

Description

In a vault with 6,700 markdown files, I found that the call on QueryRenderChild.isFilenameUnique() for every task that is rendered in search results was taking nearly as long as the actual rendering:

image

Required Steps

I'm thinking of make Task store TasksFile - and then having all tasks from the same file store the same TasksFile object.

That way, TasksFile can efficiently store whether the filename is unique and cache the results.

This is also a necessary step on the way to efficiently providing access to file properties/YAML/frontmatter to searches.

How to Test

No response

@claremacrae claremacrae added type: internal Only regards development or contributing scope: performance issues Issues with speed or responsiveness labels Mar 25, 2024
@claremacrae
Copy link
Collaborator Author

Another way to address this would be to call getMarkdownFiles() at the start of the search and pass it in to each QueryRenderChild.isFilenameUnique() call.

So there would be only one expensive call per render of a query - rather than one per task rendered.

@claremacrae claremacrae self-assigned this Mar 26, 2024
@claremacrae
Copy link
Collaborator Author

Another way to address this would be to call getMarkdownFiles() at the start of the search and pass it in to each QueryRenderChild.isFilenameUnique() call.

So there would be only one expensive call per render of a query - rather than one per task rendered.

Doing this, the result is not as clear-cut as I would have hoped:

Number of Tasks Original render time (ms) New render time (ms)
1 6.299999952316284 13.700000047683716
25 42.799999952316284 36.699999928474426
50 80.60000002384186 79.30000007152557
100 146.29999995231628 157.10000002384186
150 199.30000007152557 188.60000002384186
200 270.89999997615814 243.10000002384186
250 388.89999997615814 307.39999997615814
500 648 549.5
750 1172.2999999523163 1035.6999999284744
1000 1436.1000000238419 1197.3999999761581
2000 3021.399999976158 3805.1999999284744
3000 4647.799999952316 9491.399999976158
4000 8601.600000023842 12144.300000071526
5000 9529.099999904633 8763.399999976158

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: performance issues Issues with speed or responsiveness type: internal Only regards development or contributing
Projects
None yet
Development

No branches or pull requests

1 participant