-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shorter encoding using toString #2
Comments
Thanks for reporting this issue. I'm sure JScrewIt could do much better in merging adjacent characters like in the case you describe. The reason why I've always shunned this optimization is that it's hard to get it right without trying a potentially very large number of functions, parameters, and most of all start and end points. To summarize:
As a first step, maybe trying to encode the whole string as a toString expression would be fine. I'll be thinking about this. |
'toString' costs 3241 and numbers are cheap that 999999999999999 costs 705. If there's two high-cost letters near, merging them will always give positive effect. 'g' can be treated as half an high-cost letter. |
Thanks a lot for your ideas. It is important to me that new optimizations make encoding not just better, but as good as possible, while preserving linear complexity. JScrewIt can calculate the length of each single character quite efficiently, so there is no need for approximate cost estimations. Since you are the first person to ask for this long-due optimization, I've decided I'm going to start working on this after the next release, so don't expect anything before version 2.6.0. I'll be posting updates here as the work progresses. |
I've started to work on this issue. The next release branch already contains the logic to encode multiple characters in a |
|
This happens because |
If 1.1e21 can be written into 11e20, why not 1.1e-12 into 11e-13? |
@837951602 Sure, feel free to open a new issue. |
|
I've just completed a new optimizer: the complex optimizer uses the same principle as the toString optimizer, and has now replaced the older complex encoding mechanism. The optimizations are still the same, for example having Although this change is mostly a streamlined new implementation of existing functionality, there are a few exceptional cases where the output length would actually improve (e.g. with input |
Let's say we encoding 'hhhhh'. I directly type 'hhhhh' and get 16679 chars. Even if I select 'All new browsers', 6014 chars are generated. However 1889567..toString(18) also be 'hhhhh' and it's length is 3532 chars(All env.) and 1611 chars(new browser),
The text was updated successfully, but these errors were encountered: