v1.5.0 #35
minirang
announced in
Announcements
v1.5.0
#35
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Description
BinaryOp/UnaryOpstored the operator as astd::stringand the interpreter dispatched through anif (op == "is") ... else if (op == "+")chain. Profiling showed this cost 16.2 million string comparisons on a 635k-call benchmark — about 25 per call, the largest single cost in the engine. Now aswitchoverBinOp/UnOpassigned at parse time.fib(27): 0.241s → 0.149s.engine/common/NameInterner.h), so scope lookups compareuint32_ts over a contiguous vector instead of strings. A 400-global lookup benchmark went 0.059s → 0.027s. Names are still stored alongside for error messages.unordered_mapinsert: a hash plus a node allocation. Scopes are small in practice, soEnvironmentnow stores variables in a contiguous vector with linear lookup — one allocation per scope instead of one per variable — falling back to a lazily-built index once a scope exceeds 16 entries, which keeps large global scopes fast. Measured: 0-argument call overhead 72ns → 32ns, 3-argument 252ns → 164ns.docs/IMPLEMENTATION_NOTES.mdsection 21 for details.fib(27)0.32s → 0.140s (~56% faster), a 2M-iteration loop 0.287s → 0.173s, 3-argument call overhead 252ns → ~145ns.DLC:json(to_json,from_json). Object/array/string/number/true/false/null map onto map/list/str/number/boolean/empty.to_json(value, indent)pretty-prints. The parser is strict per RFC 8259 — trailing commas, single quotes, unquoted keys, leading zeros,NaN/Infinity, and trailing content are rejected — and decodes\uXXXXescapes including surrogate pairs. Seedocs/IMPLEMENTATION_NOTES.mdsection 19.ArgumentError(E4010ArgumentCountMismatch) was being used both for wrong argument counts and for bad argument values (sqrt(-1),to_number("abc"), malformed JSON). AddedValueError/InvalidArgumentValue(E4025) and rerouted the six value-problem sites to it. Also normalized message capitalization across every throw site: all messages now start lowercase, since they're always printed after a...at line N, column M:prefix.[any]matches one character rather than one byte ("안녕하세요" is "[any]5"is now true, previously false); literal non-ASCII characters in a pattern compile to a single multi-byte literal node; negated sets ([!num]) match non-ASCII codepoints;search()only starts attempts on codepoint boundaries and[one:...]alternatives must end on one.[edge]treats non-ASCII letters as word characters, per REGEX.md section 17.[let]/[str]/[word]/[num]/[hex]stay ASCII-only per spec. Seedocs/IMPLEMENTATION_NOTES.mdsection 17.FractionalIndex, E4024) instead of being silently rounded. Applies tolist[i],str[i], slices, andloop repeatbounds. Whole-valued doubles (2.0,6 / 2) still work.Utf8.hfromengine/interpreter/toengine/common/, since the regex engine now uses it too.tests/unit/for standalone C++ unit tests, and moved the regex engine's own test suite there (78 cases, including new Unicode ones).tests/run.shnow builds and runs it first.tests/cases/json.cuff(plus 7 error cases),tests/cases/regex_unicode.cuff,tests/cases/whole_number_indices.cuff, and 3 fractional-index error cases. All 66 script tests and 78 regex unit tests pass unchanged.This discussion was created from the release v1.5.0.
All reactions