diff --git a/.jules/bolt.md b/.jules/bolt.md index c2a5a7461..0fd13653e 100644 --- a/.jules/bolt.md +++ b/.jules/bolt.md @@ -11,3 +11,7 @@ ## 2025-03-20 - String Operations Fast Paths and Avoiding Double Searches **Learning:** When trying to optimize `strings.ToLower`, ensure you don't introduce regressions with byte-to-rune casting on UTF-8 strings. Also, `strings.Contains(s, sub)` literally calls `strings.Index(s, sub)` under the hood. Using `strings.Contains` followed immediately by `strings.Index` to extract the position is an anti-pattern that searches the string twice, undermining the intended performance optimization. **Action:** Always prefer a single `strings.Index` call over `Contains`+`Index`. Stick to one single optimization per PR to reduce risk and review burden. + +## 2025-03-25 - Efficient HTTP Response Prefix Checking +**Learning:** Using `strings.ToLower(string(body))` on large HTTP response payloads (which can be megabytes in size) to check for a small case-insensitive prefix (like ` 0 && - (strings.HasPrefix(string(body), "= 9 && bytes.EqualFold(body[:9], []byte("= 5 && bytes.EqualFold(body[:5], []byte("