Lurker News
A year ago, my co-founder launched Desktop Docs here on HN. It's a Mac app we built with Electron that uses CLIP embeddings to search photos and videos locally with natural language. We got positive feedback from HN and our first paying customers, but the app was almost 1GB and clunky to use.

TLDR; rebuilding in Rust was the right move.
So we rewrote the app with Rust and Tauri and here are the results:
- App size is 83% smaller: 1GB → 172MB - DMG Installer is 70% smaller: 232MB → 69.5MB - Indexing files is faster: A 38-minute video now indexes in ~3 minutes instead of 10-14 minutes - Overall more stability (old app used to randomly crash)
The original version worked, but it didn't perform well when you tried indexing thousands of images or large videos. We lost a lot of time struggling to optimize Electron’s main-renderer process communication and ended up with a complex worker system to process large batches of media files.
For months we wrestled with indecision about continuing to optimize the Electron app vs. starting a full rebuild in Swift or Rust. The main thing holding us back was that we hadn’t coded in Swift in almost 10 years and we didn’t know Rust very well.
What finally broke us was when users complained the app crashed their video calls just running in background. I guess that’s what happens when you ship an app with Chromium that takes up 200mb before any application code.
Today the app still uses CLIP for embeddings and Redis for vector storage and search, except Rust now handles the image and video processing pipeline and all the file I/O to let users browse their entire machine, not just indexed files.
For the UI, we decided to rebuild it from scratch instead of porting over the old UI. This turned out well because it resulted in a cleaner, simpler UI after living with the complexity of the old version.
The trickiest part of the migration was learning Rust. LLMs definitely help, but the Rust/Tauri community just isn’t as mature compared to Electron. Bundling Redis into the app was a permissioning nightmare, but I think our solution with Rust handles this better than what we had with Electron.
All in, the rebuild took about two months and still needs some more work to be at total parity with its Electron version, but the core functionality of indexing and searching files is way more performant than before and that made it worth the time. Sometimes you gotta throw away working code to build the right thing.
AMA about Rust/Tauri migration, Redis bundling nightmares, how CLIP embeddings work for local semantic search, or why Electron isn't always the answer.

Comments (443) 84 threads

Earlier comments
ebrynne1 reply#
I love the idea of wha this app is doing, and so many of the options in this space are laggy and painful, so I'm very interested in this rewrite. That said, as a photographer a lot of my media is stored as RAWs, and it's not clear whether that's supported (or perhaps its exclusion from the list of "all major image and video formats" suggests that it's not)?

Does your product have docs/a support forum/other place these kinds of details would be covered?

katrinarodri1 reply#
RAW files aren't supported yet, but we plan on including them. We're also working on a support page, I'll share that here when it's out.
ebrynne#
Thank you! Looking forward to the new features, I'll keep an eye out.
whatevermom2 replies#
Why embed Redis ? What feature do you need from Redis so bad that you need to embed it? Maybe you could just use Rust and have something performant without adding complexity?
correa_brian2 replies#
Their vector search modules are the reason I embedded it. I tried sqlite and wasn't getting good search results with the vss extension. Maybe I wasn't configuring it correctly. Redis was just better than the alternatives (qdrant, sqlite, duckdb with vector search).
zdrummond#
I would love to understand this in more depth. Any chance you could write up what you found?
nemothekid#
Are you using Flat indexes? If so they should return the same results provided you are using the same distance function. If you aren't using Flat indexes, there might be more setup, but I'd recommend just using Flat indexes. They are plenty fast on most systems for searching ~1 million vectors (assuming 1024-32 bit float vectors).

If you aren't doing anything crazy you could probably just get away with storing them all in a memory mapped file.

twen_ty1 reply#
Or alternatively, why would SQLite be not as performant as Redis in embedded context?
correa_brian#
I just wasn't able to get the similarity results to match redis. Probably my own error, but that's why I opted for it instead of SQLite. We'll revisit at some point.
mukeshsoni#
I have built something similar but only for photos - https://viroop.com. It is free for now. You have to run this command on the extracted app for MacOS to not show you the dreaded "App is damaged" dialog - `xattr -d com.apple.quarantine Viroop.app`.

My app is built with tauri too. It supports all kinds of images - - JPEG - PNG - TIFF - WEBP - BMP - ICO - GIF - AVIF - HEIC/HEIF and RAW images from various camera manufacturers.
The image reading and processing (for exporting images) is all done on the rust side. These are the crates i use - image - libheif-rs -> to read HEIF/HEIC images - rawler -> to read JPEGs embedded inside RAW images - libraw -> to convert RAW images to JPEGs and PNGs - rexiv2 -> to read image exif data
I use the candle crate to download the CLIP model and generate index pairs for images. I store the faiss indexes in a file on the file system.
I am using the app personally for about a month and it feels amazing to use something you have built yourself.
I hope to add an image editor to the app in the future so that I have my own app management and editing software which is enough for my ametuer needs.
Any kind of feedback would be most welcome.

tcshit5 replies#
As a C++ developer I shrug at those size numbers, but I’m glad you are a happy with Rust.
correa_brian#
Should we do a c++ rebuild
the__alchemist3 replies#
As a rust developer, I do too! Those are not representative of rust GUI/3D etc desktop applications. I've made some pretty complicated stuff with 2D and 3D graphics, lots of functionality; expected size is 5-15Mb on Windows, and 10-25Mb on Linux. Less if you don't need 3D.
correa_brian1 reply#
What do you think would be more in line with what you've seen in the past? There's definitely room to keep optimizing.
the__alchemist1 reply#
<25Mb for the executable. For the use case the web page desribes, probably <15Mb. It usually comes down to dependencies used.

Continue this thread — 1 reply

tonyhart73 replies#
is there a UI framework production ready yet in rust??? because for Tauri at least you can use JS which is fine

Continue this thread — 2 replies

the__alchemist#
EGUI
airstrike#
iced is the best IMHO
anthk#
Strip the Linux binaries with strip(1).
airstrike#
That has nothing to do with Rust and everything to do with Tauri.
wk_end#
OP's sort of being misleading when they say they "rewrote it in Rust", IMO. They're still using HTML and JS for their UI, rather than a native solution. The size/perf improvements mostly just come from using the OS' native engine instead of bundling Chromium.
CyberDildonics#
If you use FLTK you can start a binary with no dependencies at 100KB.

Load more comments