Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2025-02-15 - Fast text search

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remove bot metadata from the repo root

This adds a new top-level .jules/ directory for transient agent notes, but AGENTS.md says to “Prefer adding a new top-level directory only for a durable category of repo content.” Keeping this file commits bot-local state that is not a product, docs, release, or source-of-truth artifact, so the repository shape drifts from the documented contract; please drop it or move any durable guidance into an existing maintained file.

Useful? React with 👍 / 👎.

**Learning:** In terminal_search, for_each_char_match_start was extracting substring arrays which makes string comparison slower.
**Action:** Optimize string matching loops to quickly short circuit on first char difference.
11 changes: 9 additions & 2 deletions crates/forktty-ui-gtk/src/gtk_app/terminal_search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,18 @@ fn for_each_char_match_start(
if needle.is_empty() {
return;
}
let first_needle = needle[0];
let mut index = 0;
while index + needle.len() <= haystack.len() {
let matched = haystack[index..index + needle.len()]
// Fast-path: short-circuit the full substring check if the first character
// doesn't match, avoiding iterator overhead in the common case.
if !chars_eq_ignore_case(haystack[index], first_needle) {
index += 1;
continue;
}
let matched = haystack[index + 1..index + needle.len()]
.iter()
.zip(needle)
.zip(&needle[1..])
.all(|(a, b)| chars_eq_ignore_case(*a, *b));
if matched {
if !visit(index) {
Expand Down
Loading