pell icon indicating copy to clipboard operation
pell copied to clipboard

Micro size optimizations

Open bcolucci opened this issue 7 years ago • 4 comments

With these little optimizations, we save about 13% of the initial size (3544 b to 3087).

bcolucci avatar Mar 20 '18 13:03 bcolucci

@bcolucci thanks, lots of good stuff here. Only thing is the shortcuts for the window methods (e.g. addEventListener) do actually decrease the minified file size, especially when they are used more than once. It's because then the file only has to have a reference to a method name like addEventListener, then the variable referencing it can be something like a = .... Other than that, I'll implement some of these changes, thanks!

jaredreich avatar Mar 20 '18 14:03 jaredreich

Only thing is the shortcuts for the window methods (e.g. addEventListener) do actually decrease the minified file size, especially when they are used more than once. It's because then the file only has to have a reference to a method name like addEventListener, then the variable referencing it can be something like a = ....

That depends on the features added to the library in the future. For now, this PR looks great!

ramlmn avatar Mar 20 '18 14:03 ramlmn

Could also be great to merge the testing environment PR, so we will be able to test ;)

bcolucci avatar Mar 20 '18 20:03 bcolucci

@jaredreich I've reduced the actual code. But yeah, of course, if you use more (in next release) these shortcuts it's better to have them declared as you said.

bcolucci avatar Mar 21 '18 08:03 bcolucci