brandon1024 / find

A find-in-page extension for Chrome and Firefox that supports regular expressions.
https://chrome.google.com/webstore/detail/find%2B-regex-find-in-page/fddffkdncgkkdjobemgbpojjeffmmofb
GNU General Public License v3.0
402 stars 52 forks source link

Performance comparison vs default Ctrl-F #377

Closed azhx closed 1 year ago

azhx commented 2 years ago

I'm wondering how the performance of this extension compares to ctrl-F, if you've done any such benchmarking. One specific thing I'm curious if you know about is how Ctrl-F is rendering their text highlights. From a cursory glance at chrome/firefox devtools for example, it doesn't seem like they need to wrap highlighted text in spans--I assume they have some lower level api that handles this. Do you know how that works?

brandon1024 commented 2 years ago

Hey @azhx, thanks for your interest in Find+!

The performance of this extension is certainly worse than the native tool, purely because this extension works by manipulating the DOM (and is written in JavaScript) while the native find in page tool is written in C++ and is more closely tied to the internals of the browser rendering engine. This extension really struggles with large pages because there's a lot of work that goes into traversing the DOM, wrapping text in inline elements, and scanning for matches. Not to mention that a lot of that work is done serially, in a single thread. The native tool performs better.

When I first built this extension, I went digging through the Chromium source code to track down the implementation of the native find-in-page tool, but I don't remember the specifics.

To answer your question though, I have never done any performance benchmarks.