chrisgrieser / shimmering-obsidian

Alfred Workflow with dozens of features for controlling your Obsidian vault.
https://alfred.app/workflows/chrisgrieser/shimmering-obsidian/
MIT License
817 stars 40 forks source link

[Bug]: Slow first search #148

Closed Sinled closed 11 months ago

Sinled commented 11 months ago

Bug Description

Hi, thanks for this nice workflow, but i am having relatively big vault (~4000 files), and first search takes ages, like 15-20 seconds. Given that i usually search once or twice a day, almost all my searches take such amount of time.

Is it expected behaviour or something can be done about it? Alfred's native file search finds corresponding files instantly.

PS. It seems there are newer version of workflow, but it is not in the Alfred gallery.

Relevant Screenshot

Screenshot 2023-09-12 at 11 44 46

To Reproduce

No response

Debugging Log

[11:43:48.138] Logging Started...
[11:43:52.824] Shimmering Obsidian[Script Filter] Queuing argument '(null)'
[11:44:08.441] Shimmering Obsidian[Script Filter] Script with argv '(null)' finished
[11:44:08.447] Shimmering Obsidian[Script Filter] {"items":[{"title":

Workflow Configuration

Screenshot 2023-09-12 at 11 57 04

Version & System Information

-------------------------------
INTERNAL WORKFLOW CONFIGURATION
Vault Path: /Users/sinled/Library/Mobile Documents/iCloud~md~obsidian/Documents/main
config folder: exists
Metadata JSONs: 4/4
metadata.json String Length: 3936720
-------------------------------
WORKSPACE DATA
'workspace.json' exists
-------------------------------
SYSTEM
macOS: 13.5.2
Alfred: 5.1.2
-------------------------------
INSTALLED VERSION
Obsidian: 1.4.11
This Workflow: 4.0.4
Advanced URI Plugin: 1.38.1
Metadata Extractor: 1.1.0
-------------------------------
LATEST VERSION
Obsidian: 1.4.11 (Insider: 1.4.11)
This Workflow: 4.1.0
Advanced URI Plugin: 1.38.1
Metadata Extractor: 1.1.0
-------------------------------

Last working version

No response

Make sure you have done the following

chrisgrieser commented 11 months ago

PS. It seems there are newer version of workflow, but it is not in the Alfred gallery.

yeah, the Alfred Gallery unfortunately does not update instantly. Update should be in the gallery in the next few days. Or you can just update manually by downloading the latest release from github: https://github.com/chrisgrieser/shimmering-obsidian/releases/tag/4.1.0


Hmm, I have a similar number of notes and do not experience such a lag, it takes less than a second for me.

Could you elaborate what exactly you mean by "first search"? First search in a given day, in a given hour? Any subsequent searches are quick?

The first search being slow and following searches being slow should not be related to this workflow, since this workflow does exactly the same thing on every run. So just the first run being slow should either be an issue with Alfred or with your system. I'd try:

Sinled commented 11 months ago

Could you elaborate what exactly you mean by "first search"? First search in a given day, in a given hour? Any subsequent searches are quick?

i am not sure of exact time period, but for example when i tried first time in the morning - it took 16 seconds, after that subsequent searches worked fine, then again an hour ago was long search and subsequent searches worked fine.

updating to the latest version of this workflow

thanks i'll try when with new version when it will available in the Gallery.

Sinled commented 11 months ago

I've tried 4.1.0 version, and result is the same - long first search. I've tried to add logs to main script and here is result

[12:55:40.694] Shimmering Obsidian[Script Filter] Queuing argument '(null)'
[12:56:00.928] Shimmering Obsidian[Script Filter] Script with argv '(null)' finished
[12:56:00.935] STDERR: Shimmering Obsidian[Script Filter] 2023-09-17T09:55:41.038Z - imports

2023-09-17T09:55:41.107Z - END: imports

2023-09-17T09:55:41.107Z - run

2023-09-17T09:55:41.107Z - run init

2023-09-17T09:55:41.193Z - END: run init

2023-09-17T09:55:41.198Z - bookmark stars

2023-09-17T09:55:41.205Z - END: bookmark stars

2023-09-17T09:55:41.205Z - read metadata

2023-09-17T09:55:41.248Z - END: read metadata

2023-09-17T09:55:41.248Z - path to search

2023-09-17T09:55:42.571Z - END: path to search

2023-09-17T09:55:42.571Z - apply exclude filter

2023-09-17T09:55:42.574Z - END: apply exclude filter

2023-09-17T09:55:42.574Z - CONSTRUCTION OF JSON FOR ALFRED

2023-09-17T09:56:00.732Z - END: CONSTRUCTION OF JSON FOR ALFRED

2023-09-17T09:56:00.732Z - CANVASES

2023-09-17T09:56:00.733Z - END: CANVASES

2023-09-17T09:56:00.733Z - FOLDERS

2023-09-17T09:56:00.739Z - END: FOLDERS

2023-09-17T09:56:00.739Z - ADDITIONAL OPTIONS WHEN BROWSING A FOLDER

2023-09-17T09:56:00.740Z - END: ADDITIONAL OPTIONS WHEN BROWSING A FOLDER

2023-09-17T09:56:00.740Z - serialize results

2023-09-17T09:56:00.774Z - END: serialize results

2023-09-17T09:56:00.774Z - END: run
[12:56:00.936]

it seems it stays CONSTRUCTION OF JSON FOR ALFRED most of the time

chrisgrieser commented 11 months ago

Hmm, I found one point which might be responsible for some slowdown. I released version 4.2.0, which might fix the issue: https://github.com/chrisgrieser/shimmering-obsidian/releases/download/4.2.0/shimmering-obsidian.alfredworkflow

Sinled commented 11 months ago

It seems it is working fine now, thanks