Why Nostr? What is Njump?
2024-03-13 18:36:06

Lea Verou on Nostr: When doing case-insensitive matching of a needle (string) against a haystack ...

When doing case-insensitive matching of a needle (string) against a haystack (potentially large array of strings), which is faster:
1. toLowerCase() (once on needle, then per each item in the haystack)
2. Create regex with i flag, use regex.test()

I would guess 1, but haven't checked. Does anyone know of any benchmark?
Author Public Key
npub1m6e8q4lxpwxhjcczsjfsnf79g24pcuvppzlysycgdh40jyualamqapyan3