Skip to content

Conversation

@tiensonqin
Copy link
Contributor

@tiensonqin tiensonqin commented Jan 29, 2024

This PR aims to reduce both the app start time and memory usage.

A demo with 30k pages:
https://www.loom.com/share/69a2b9d81be5416eb6f56bacb15daff6

TODO:

  • fix custom query
  • check all d/q and react/q calls
  • fix export
  • file/path file/content handling
  • fix plugins api
  • fix error "file has been modified on the disk" for file graphs
  • file graph re-index
  • build tx-data from the db worker instead of in the UI thread (make sure the data are from the latest full db)
  • add malli schema for outliner ops
  • fix ux issues
  • delay loading pages when app starts (eventually we'd like to get rid of this)
  • test data sync from rtc

@tiensonqin tiensonqin changed the title Perf enhancement: lazy load data for UI Perf enhancement: load partial data for UI needs Jan 30, 2024
@tiensonqin
Copy link
Contributor Author

Of the 3 graphs I measured via the :restore-graph-from-sqlite!-prepare, the only one that had a slower time was my db graph. Maybe it's because it has 5.8k properties? Here's the raw numbers:

- feat/db
	- work/docs: 2447 ms  Datoms in total:  76492
	- logseq-notes: 2730 ms  Datoms in total:  134855
	- durm: 632 ms  Datoms in total:  38572
- new branch
	- work/docs: 1153 ms
	- logseq-notes: 2280ms
	- durm: 1646 ms

I've done some QA and hope to do a little more tomorrow. A weird bug I'm seeing is the lazy loading of page names in page refs. They initially show up as all lower cased but when I navigate back, they show up as correctly cased. This is also occurring with page property values and with tag names that are listed to the right of a tagged block. This bug was noticed in publishing first but this also affects desktop

Your durm graph should be loaded faster with 140287e, the lower-cased bug should be fixed too.

@tiensonqin
Copy link
Contributor Author

Deleting a db graph while in the graph consistently fails

I'm unable to reproduce this bug, is it on Web or Electron?

@tiensonqin
Copy link
Contributor Author

On a blank journal page, hit tab and then enter on the first block. No edits are able to save after this. This also happens if the block has content. Basically testing if someone accidentally indents in an unexpected place

I can reproduce this one, looking into it now.

@logseq-cldwalker
Copy link
Collaborator

logseq-cldwalker commented Feb 6, 2024

Your durm graph should be loaded faster with 140287e, the lower-cased bug should be fixed too

Confirmed the lower-case page bug is fixed. durm and other db graphs are loading faster. Thanks! Seeing a major improvement now at around 150ms

@logseq-cldwalker
Copy link
Collaborator

Deleting a db graph while in the graph consistently fails

I'm unable to reproduce this bug, is it on Web or Electron?

It was on electron. I'm no longer able to reproduce so that's good

@tiensonqin
Copy link
Contributor Author

No edits are able to save

@logseq-cldwalker This should be fixed now. I have to clear the worker requests if they haven't updated the db.

Copy link
Collaborator

@logseq-cldwalker logseq-cldwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing the indent bug and the frontend tests. As discussed elsewhere I was able to see subsecond load times on a graph with 50k pages. Amazing work! 👍 🚀

@logseq-cldwalker
Copy link
Collaborator

@tiensonqin A bug I encountered on a browser db graph: Go to an existing journal page. Press g p to go to a previous day that does not exist. No journal page shows up

@tiensonqin
Copy link
Contributor Author

Press g p to go to a previous day that does not exist. No journal page shows up

@logseq-cldwalker I'll fix this in another commit.

@tiensonqin tiensonqin merged commit df2925f into feat/db Feb 9, 2024
@tiensonqin tiensonqin deleted the perf/lazy-load-data branch February 9, 2024 01:29
@tiensonqin
Copy link
Contributor Author

@logseq-cldwalker The bug has been addressed by cba42f1.

@logseq-cldwalker
Copy link
Collaborator

Confirmed. Thanks!

logseq-cldwalker added a commit that referenced this pull request Feb 9, 2024
This ns is more appropriate in db and was only in graph-parser because
the date-time-util lib wasn't accessible to db until #10933 landed.
graph-parser dep is specific to file graphs and as much as possible
anything unrelated to this should not be in this dep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants