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: performance improvement deriveInitialInput #20

Merged
merged 2 commits into from
Feb 28, 2019

Conversation

Pruxis
Copy link
Collaborator

@Pruxis Pruxis commented Feb 28, 2019

By mutating the accumulator in the reduce function we no longer copy the entire object which is quite expensive.

If you wish I can write a test displaying the difference in execution time.

By mutating the accumulator in the reduce function we no longer copy the entire object which is quite expensive.
If you wish I can write a test displaying the difference in execution time.
@codecov-io
Copy link

codecov-io commented Feb 28, 2019

Codecov Report

Merging #20 into master will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #20      +/-   ##
==========================================
+ Coverage    96.8%   96.83%   +0.03%     
==========================================
  Files          17       17              
  Lines         250      253       +3     
  Branches       42       42              
==========================================
+ Hits          242      245       +3     
  Misses          8        8
Impacted Files Coverage Δ
src/helpers/deriveInitial.ts 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0f91f91...039918f. Read the comment docs.

Copy link
Owner

@JoviDeCroock JoviDeCroock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Pruxis,

Let me start off by thanking you for this PR, always nice to see things like these pop up.

The optimization is in line with what we are trying to achieve here, a performant form library with a low bundlesize footprint, this fix does not only decrease initial memory consumption but also does a slight decrease in bundlesize since it does not have to duplicate the _rest helper for the operations.

This makes for a mutation but in theory this is no big deal since it happens isolated on a fresh object, however it slightly decreases readability but I can live with that for the plusses I just summed up.

A test does not seem to be needed for me, I personally am looking to set up a benchmark in the near future though.

Thanks for the work on this and it will be released tonight in version 1.5.1, I'll include it in the CHANGELOG (which I planned to start on the first PR to give some kudo's to contributors).

PS: don't worry about the bundlesize check, I don't know why it is not completing.

@JoviDeCroock JoviDeCroock merged commit 1c50045 into JoviDeCroock:master Feb 28, 2019
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.

3 participants