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

use short method names #863

Merged
merged 2 commits into from
Sep 20, 2017
Merged

use short method names #863

merged 2 commits into from
Sep 20, 2017

Conversation

Rich-Harris
Copy link
Member

We can save a few bytes by using short method names for fragments — m instead of mount, c instead of create and so on. We can use function names for stack traces and to preserve readability (to some extent), which disappear during minification.

On the project I'm trying this out with, the minified output is 2.5% smaller, while the gzipped output is 0.3% smaller.

Question: are these savings worth the slight loss of readability?

@Conduitry
Copy link
Member

I think this is a good idea - would it help to add a comment on the lines where the short methods are being called from?

whatever.c(); // create

@Rich-Harris
Copy link
Member Author

Could do, though I thought it might make the output quite 'noisy', and I figured it would be reasonably self-explanatory since most of the time the method is called inside a method of the same name:

d: function destroy() {
  if_block.d();
}

@Rich-Harris Rich-Harris merged commit 3c405af into master Sep 20, 2017
@Rich-Harris Rich-Harris deleted the short-method-names branch September 20, 2017 16:57
TehShrike added a commit to KayserCommentaryOrg/revelation-project that referenced this pull request Sep 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants