Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Optimize wrapper based on #107 (comment).
Replace
\
in escape character witht
(cheapest symbol outside of base 16 numbers) on compile stage. On runtime stage replacet
back with\
before passing the string into theFunction
constructor. To avoid usingreplace(x,y)
function which requires 2 arguments usesplit()
andjoin()
functions.The "cost" of additional characters is about ~100.
Without this optimization one unmapped caracter has encoded length of about 3600 characters. Every additional unmapped character adds 2000 to the total length.
For example, the length of
~
is 3605,~~
is 5600, and~~~
is 7595.The loader with replace has encoded length of about 5300 characters and every additional character adds 100 to the total length.
In the same example the length of
~~
becomes 5371 and~~~
-- 5463.So, when we have more than one unmapped character we want to encode whole input except select characters (that have encoded length less than about 70) into an escape sequence.