Skip to content

things: optimize JXA performance with properties() batching - #24286

Merged
raycastbot merged 2 commits into
raycast:mainfrom
bendrucker:things/jxa-performance-optimization
Jan 12, 2026
Merged

raycastbot merged 2 commits into
raycast:mainfrom
bendrucker:things/jxa-performance-optimization

Conversation

@bendrucker

@bendrucker bendrucker commented Jan 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

Optimizes JXA performance in the Things extension by using properties() batching instead of individual property calls. This reduces Apple Event overhead from ~15+ round-trips per todo to ~3-4, resulting in ~75% faster list loading times.

This is particularly impactful on macOS Tahoe, where Apple Event latency appears to have increased significantly. Before this change, loading 28 todos took ~5+ seconds. After, it takes ~1-1.5 seconds.

Changes

  • api.ts: Rewrote getListTodos to use properties() batching for todos, projects, and areas
  • api.ts: Applied same optimization to getProjects, getAreas, and getTagsProjectsAndAreas mapping templates
  • Made tags optional in Area type since nested areas no longer include them

Benchmark Results

List Items Baseline Optimized Improvement
Inbox 5 782ms 149ms 81% faster
Today 28 5,295ms 1,141ms 78% faster
Upcoming 42 7,050ms 1,629ms 77% faster
Anytime 49 8,911ms 1,993ms 78% faster

Breaking Change: Nested Area Tags Removed

Tags on containing areas (todo.area.tags, todo.project.area.tags) are no longer fetched. Todo and project data now only includes:

  • todo.tags — the todo's own tags
  • todo.project.tags — the project's tags
  • todo.area.name / todo.project.area.name — area names (still available)

Nested area tags required additional Apple Event calls per todo and provided marginal value—users are unlikely to need a tag assigned to a todo's grandparent area. Removing them contributes ~14% additional performance improvement.

Screencast

N/A - performance optimization with no visual changes.

Checklist

@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: things Issues related to the things extension AI Extension platform: macOS OP is contributor The OP of the PR is a contributor of the extension labels Jan 8, 2026
@raycastbot

raycastbot commented Jan 8, 2026 •

Copy link
Copy Markdown
Collaborator

Thank you for your contribution! 🎉

🔔 @loris @andreaselia @jfkisafk @thomaslombart @srikirank @vimtor @samuelkraft @vmrjnvc @dinocosta @janosorcsik you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

📋 Quick checkout commands
BRANCH="things/jxa-performance-optimization"
FORK_URL="https://github.com/bendrucker/extensions.git"
EXTENSION_NAME="things"
REPO_NAME="extensions"

git clone -n --depth=1 --filter=tree:0 -b $BRANCH $FORK_URL
cd $REPO_NAME
git sparse-checkout set --no-cone "extensions/$EXTENSION_NAME"
git checkout
cd "extensions/$EXTENSION_NAME"
npm install && npm run dev

Due to our current reduced availability, the initial review may take up to 10-15 business days.

Comment thread extensions/things/CHANGELOG.md Resolved
@bendrucker
bendrucker force-pushed the things/jxa-performance-optimization branch from 860441d to e0204fe Compare January 8, 2026 06:27
@0xdhrv

ghost commented Jan 8, 2026

Copy link
Copy Markdown
Member

@greptileai, could you please do a fresh review of this PR?

@0xdhrv 0xdhrv self-assigned this Jan 8, 2026
@bendrucker bendrucker changed the title things: optimize JXA performance with properties() batching things: optimize JXA performance with properties() batching Jan 8, 2026
@bendrucker bendrucker mentioned this pull request Jan 8, 2026
5 tasks done
@janosorcsik

ghost commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

Hi @bendrucker,
Thank you for optimizing the list command.
I'd like to ask if you could apply the same optimization to the other get commands that use JXA to improve their performance as well?

@bendrucker
bendrucker force-pushed the things/jxa-performance-optimization branch from fd7e077 to 9c5e1f6 Compare January 8, 2026 07:53
@bendrucker

ghost commented Jan 8, 2026

Copy link
Copy Markdown
Contributor Author

Done! Applied properties() batching to the mapProjectJxa, mapAreaJxa, mapProjectTodoJxa, and mapAreaTodoJxa templates as well. These are used by getProjects, getAreas, and getTagsProjectsAndAreas.

@bendrucker
bendrucker force-pushed the things/jxa-performance-optimization branch from 9c5e1f6 to 58b80a9 Compare January 8, 2026 07:54
Reduces list loading times by ~75% by batching property fetches into
single Apple Events instead of individual calls per property.

Also removes nested area tags (tags on containing areas) from todo data
to further reduce Apple Event overhead.
@bendrucker
bendrucker force-pushed the things/jxa-performance-optimization branch from 58b80a9 to 4aaf150 Compare January 8, 2026 07:55
@pernielsentikaer pernielsentikaer self-assigned this Jan 12, 2026

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me, approved 🔥

@raycastbot
raycastbot merged commit 233b64a into raycast:main Jan 12, 2026
@github-actions

ghost commented Jan 12, 2026

Copy link
Copy Markdown
Contributor

@raycastbot

ghost commented Jan 12, 2026

Copy link
Copy Markdown
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

@janosorcsik

ghost commented Jan 13, 2026

Copy link
Copy Markdown
Contributor

Hi @pernielsentikaer,
Could you please reopen the PR? The missing tags weren't re-added to the script, and the extension has now lost this feature.

@bendrucker

ghost commented Jan 14, 2026

Copy link
Copy Markdown
Contributor Author

Could you please reopen the PR?

You can't "reopen" merged changes, merged is a terminal state, the side effect already happened on the target branch.

The "missing" tags

Are you talking about the well-documented breaking change or something else?

If you are now realizing you really want it the old way, the way forward is another PR to make that change. Though I'd advocate for a preference to control whether area tags are fetched. It's a large performance penalty to fetch related data most users won't populate. That's a bit of conjecture on my part, but I'm coming up on 15 years with Things and I've never once tagged an area.

@janosorcsik

ghost commented Jan 14, 2026

Copy link
Copy Markdown
Contributor

Hi @bendrucker,
I meant either reverting the change or fixing it in a follow-up PR.

About the breaking change: just because you documented it doesn't mean it's the right call. The tags were there and working. Removing them just because you haven't used them in 15 years isn't a valid reason. By that logic, we could remove any feature that some users don't need.

The performance improvement is valuable, but it shouldn't come at the cost of removing functionality. If performance is the concern, a preference toggle makes sense, but the feature should stay by default.

I flagged this in my review before the merge. People's workflows are broken now. Can you restore the tags in a follow-up?

@bendrucker

ghost commented Jan 14, 2026

Copy link
Copy Markdown
Contributor Author

I flagged this in my review before the merge.

Where? Look, I can do this, but if you want it urgently, just open the revert PR, it doesn't need to be a discussion.

@bendrucker

ghost commented Jan 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Re default, it doesn't work this way in Things afaict. My usage is just an example. I proposed the breaking change because i saw a mismatched default behavior with a large perf cost.

Edit: Will document Things native behavior more thoroughly, but the more fundamental issue here is loading up every attribute and allowing full text search of a specific list. That's not how Things search behaves, it's more of a Raycast concept. That is why a performance penalty is being paid on load regardless of whether you depend on ancestor tagging for search. Gonna explore a bigger UI change so that the Raycast search bar isn't so overloaded and filtering works more like Things native UI.

Edit 2: Yeah, inheritance is quite complicated. It's not just todo -> project -> area, tags have parent relationships too. As pondered above I am going to propose a bigger change, since functional parity with Things with the current extension UI would see a perf cost of more like 50%.

@pernielsentikaer

ghost commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

Are we waiting for a fix here?

@janosorcsik

ghost commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

#24489 PR will add the tag filter feature. cc: @pernielsentikaer

@bendrucker

ghost commented Jan 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Yes! I might have some time this afternoon to finish ⏫ up.

@bendrucker
bendrucker deleted the things/jxa-performance-optimization branch June 10, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Extension extension fix / improvement Label for PRs with extension's fix improvements extension: things Issues related to the things extension OP is contributor The OP of the PR is a contributor of the extension platform: macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants