Mercurial > repos > tabletprog
comparison modules/string.tp @ 243:5b830147c1cd
Use a lightweight substring object in a few places in the parser to improve performance for large files.
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 05 Jan 2014 23:07:26 -0800 |
parents | 38140b7dbe3d |
children | 32964a4e7a33 |
comparison
equal
deleted
inserted
replaced
242:0e7982adc76b | 243:5b830147c1cd |
---|---|
23 argb <- (string ptr) | 23 argb <- (string ptr) |
24 } andCode: :argb { | 24 } andCode: :argb { |
25 if: len = (argb len) && bytes = (argb bytes) && (not: (memcmp: data (argb data) bytes)) { | 25 if: len = (argb len) && bytes = (argb bytes) && (not: (memcmp: data (argb data) bytes)) { |
26 true | 26 true |
27 } | 27 } |
28 } | |
29 | |
30 llMessage: compareSub withVars: { | |
31 argb <- string ptr | |
32 myoff <- obj_int32 ptr | |
33 boff <- obj_int32 ptr | |
34 clen <- obj_int32 ptr | |
35 intret <- obj_int32 ptr | |
36 } andCode: :argb myoff boff clen { | |
37 intret <- make_object: (addr_of: obj_int32_meta) NULL 0 | |
38 intret num!: (memcmp: data + (myoff num) (argb data) + (boff num) (clen num)) | |
39 intret | |
28 } | 40 } |
29 | 41 |
30 llMessage: NEQ_ withVars: { | 42 llMessage: NEQ_ withVars: { |
31 argb <- (string ptr) | 43 argb <- (string ptr) |
32 } andCode: :argb { | 44 } andCode: :argb { |
273 from: start withLength: (end - start) | 285 from: start withLength: (end - start) |
274 } | 286 } |
275 | 287 |
276 isInteger? <- { false } | 288 isInteger? <- { false } |
277 isString? <- { true } | 289 isString? <- { true } |
290 isBasicString? <- { true } | |
278 } | 291 } |