Skip to content
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

String delimiter : optimize tiebreaker #60

Open
Siorki opened this issue Dec 24, 2016 · 0 comments
Open

String delimiter : optimize tiebreaker #60

Siorki opened this issue Dec 24, 2016 · 0 comments

Comments

@Siorki
Copy link
Owner

Siorki commented Dec 24, 2016

In the implementation of #55, the delimiter ', " or ` (ES6 only) for the packed string is chosen based on the shortest string after preprocessing (the one with the least escapes needed).

A tie between two is a common case, as most strings do not themselves contain another quote. Thus the same delimiter can be used for all of them, leaving the two others as equal options for the packed string.

The current tiebreaker is to avoid changing the delimiter of existing strings inside the code. Within the benchmark set, this solution gives gains in specific cases and no losses otherwise (compared to before #55).

Improvements are possible. The differences found among the benchmarks are :

  • Flappy Dragon : 977 with ` vs 978 with "
  • jscrush : 989 with " or ' vs 990 with `
  • Firewatch : 1029 with " or ` vs 1032 with '

This should be achievable by changing the tiebreaker of the cost function to account for the blocks that are formed / merged in the packer stage depending on the delimiter. A deeper analysis is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant