retro-describe: some small optimizations, use hash based name comparison

FossilOrigin-Name: 7a95e298420f20876087ae02c6181372f91ec937e6d5622cb3d685a9e4f8d5bf
This commit is contained in:
crc 2023-11-03 14:15:25 +00:00
parent 90bbf5b098
commit f3f06cb180
2 changed files with 6 additions and 4 deletions

View file

@ -32,5 +32,7 @@
- add example/irc-logger.retro
- add example/ilo-export.retro
- file:read-line no longer uses buffer:
- retro-describe now using hash based name comparison
- retro-describe small reductions in call/return overhead
================================================================

View file

@ -143,13 +143,13 @@ the description.
{{
'Target var
'LineNumber var
:matched? (-f) field:name @Target s:eq? ;
:matched? (-f) field:name s:hash @Target eq? ;
:entry? (-f) @LineNumber DATA-START gteq? &LineNumber v:inc ;
:process (-) &Heap [ s:keep !SourceLine matched? [ display-result ] if ] v:preserve ;
:process (-) &Heap [ s:keep !SourceLine matched? &display-result if ] v:preserve ;
---reveal---
:find-and-display-entry
#0 !LineNumber s:keep !Target
script:name [ entry? [ process ] [ drop ] choose ] file:for-each-line nl ;
#0 !LineNumber s:hash !Target
script:name [ entry? &process &drop choose ] file:for-each-line nl ;
}}
~~~