ludic.ui: string matching compares in place - at_alias, lk_in, colours and every s[a..b] == p made a string per position tried, per rule, per element, per frame (a benchmark page: ~3 MB -> 256 KB a frame)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8808dda605
commit
83200a453b
17 changed files with 84 additions and 50 deletions
|
|
@ -39,3 +39,13 @@ function lib_beside(path: string, src: string) -> string {
|
|||
if cut < 0 { return src }
|
||||
return path[0..cut + 1] + src
|
||||
}
|
||||
# `s` has `p` starting at `at`: compared in place, where s[at..at + len(p)] == p made a new string
|
||||
# for every place it looked (Ludic frees nothing, and the cascade asks this per element per frame)
|
||||
function sat(s: string, at: int, p: string) -> bool {
|
||||
let n = len(p)
|
||||
if at < 0 or at + n > len(s) { return false }
|
||||
for i in 0 .. n {
|
||||
if s[at + i] != p[i] { return false }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue