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

feat(codegolf): reduce browser code #127

Merged
merged 1 commit into from
Feb 19, 2021
Merged

feat(codegolf): reduce browser code #127

merged 1 commit into from
Feb 19, 2021

Conversation

pveyes
Copy link
Owner

@pveyes pveyes commented Feb 19, 2021

Refactor conversion logic by

  • Use Array.from instead of creating new array and for loop & array.push
  • reducing repeated long property access (obj.property) by assigning to another variable that can be minified better
  • removing full JSON attribute mapping and rely more on DOM property

Also simplify file structure and group attribute mapping into single file

Size comparison

gzipped original
Before 1.68 kB 3.5 kB
After 1.2 kB 2.4 kB

~29% reduction

@pveyes pveyes changed the title feat(reduce browser code feat(codegolf): reduce browser code Feb 19, 2021
@pveyes pveyes force-pushed the codegolf branch 7 times, most recently from d52ad69 to 8f0d040 Compare February 19, 2021 07:16

Unverified

This user has not yet uploaded their public signing key.
@pveyes pveyes merged commit 130125e into master Feb 19, 2021
@pveyes pveyes deleted the codegolf branch February 19, 2021 07:31
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

1 participant