logseq / logseq/db-test

CLI has 1/4 second overhead (95%)

Open
#952 1 comment 0 reactions 1 assignee View on GitHub

@RCmerci is already working on this.

Since Jun 22, 2026.

Dominant language
No language data
Stars
28
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Search first
  • I searched and no similar issues were found
What Happened?

When i add one block to a page with the CLI, it spends 95% of the time with overhead and only 5% with actually adding the block.

Image

This is probably because of the technology and architecture (Node.js).

It does not get faster when the DB is on an NVMe SSD or Ramdisk, so reading/writing data to disk is not the bottleneck. I think it actually is the CPU.

Reproduce the Bug
  1. add one block
[davidak@gaming:~/code/scripts/logseq/sync-test]$ time /home/davidak/.local/bin/logseq --graph "Demo" upsert block --target-page "AB" --blocks '[{:block/title "A"}]'
Value
9058
Count: 1

real	0m0.234s
user	0m0.232s
sys	0m0.029s
  1. clean up page
/home/davidak/.local/bin/logseq remove block   --graph "Demo"   --id "$(
    /home/davidak/.local/bin/logseq \
      --graph "Demo" \
      --output json \
      show --page "AB" \
    | jq -c '[.data.root["block/children"][]."db/id"]'
  )"
  1. add 10 blocks to compare
time /home/davidak/.local/bin/logseq --graph "Demo" upsert block --target-page "AB" --blocks '[{:block/title "A"}{:block/title "A"}{:block/title "A"}{:block/title "A"}{:block/title "A"}{:block/title "A"}{:block/title "A"}{:block/title "A"}{:block/title "A"}{:block/title "A"}
]'
Value
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
Count: 10

real	0m0.327s
user	0m0.236s
sys	0m0.044s
Expected Behavior

The overhead should be as minimal as possible. A 10x improvement would be make every command feel more responsive.

Screenshots

No response

Files

CLI Overhead.ods

Browser, Desktop or Mobile Platform Information

NixOS 25.11.10684.8fd9daa3db09
Logseq-linux-x86_64-2.0.1-alpha+nightly.20260619

Additional Context
Hardware

PC from 2019:

  • Intel i9-9900K processor at 3.6 GHz (5GHz boost)
  • G.Skill Ripjaws 64 GB DDR4 RAM (3200 MHz)
  • Sata SSD
Theory

Adding one block + overhead = on average 0.252

Adding 10 blocks + overhead = 0.453

to get the time one block takes without overhead, we calculate:

0.453 - 0.252 = 0.201 (time for 9 blocks without overhead) / 9 = 0.022

then we can calculate just the overhead

0.252 - 0.022 = 0.230

Are you willing to submit a PR? If you know how to fix the bug.
  • I'm willing to submit a PR (Thank you!)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.