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

Chore/optimize #10091

Merged
merged 1 commit into from Nov 4, 2018
Merged

Chore/optimize #10091

merged 1 commit into from Nov 4, 2018

Conversation

@SimonSchick
Copy link
Member

@SimonSchick SimonSchick commented Oct 28, 2018

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

This PR does a couple of things (please advise if I should split this into separate PRs) that are all somewhat related.

Replace various operations with faster equivalents (contains some minor else if simplification as well.
Main component is the replacement of _.memoize which was used to cache array lookups with shiny Sets. This also removes some dead code.

While debugging and issue I got really frustrated with the amount of conditional nesting is going on
I reduced the amount of return } else if (...) by roughly 50% (mostly using return instead).
In query.js I also wrapped some promises that were doubled wrapped and nested for some reason, this code is drastically simpler now This broke stuff, I still moved the post query logic to a method to make it easier to read.

NOTE: I switched the test reporter to dot as that is slightly faster and doesn't create so much useless output, please mention if this is undesirable.
Replaces all occurences of new Buffer and sinon.sandbox.create and stubbed out (most) data-type related warnings that were spamming logs.
Also refactored ABSTRACT prototype class to class since it's never directly instantiated. Nvm see nodejs/node#23960

Previously forgot to port this :)

@codecov
Copy link

@codecov codecov bot commented Oct 29, 2018

Codecov Report

Merging #10091 into master will decrease coverage by 0.06%.
The diff coverage is 96.17%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10091      +/-   ##
==========================================
- Coverage   96.37%    96.3%   -0.07%     
==========================================
  Files          63       63              
  Lines        9411     9424      +13     
==========================================
+ Hits         9070     9076       +6     
- Misses        341      348       +7
Impacted Files Coverage Δ
lib/deferrable.js 73.33% <ø> (ø) ⬆️
lib/table-hints.js 100% <ø> (ø) ⬆️
lib/dialects/mysql/query.js 98.46% <100%> (+0.01%) ⬆️
lib/utils/validator-extras.js 97.56% <100%> (ø) ⬆️
lib/dialects/postgres/query-generator.js 94.02% <100%> (ø) ⬆️
lib/instance-validator.js 97.54% <100%> (ø) ⬆️
lib/hooks.js 97.05% <100%> (ø) ⬆️
lib/sequelize.js 96.63% <100%> (+0.01%) ⬆️
lib/dialects/postgres/data-types.js 97.87% <100%> (ø) ⬆️
lib/dialects/postgres/query.js 97.44% <100%> (ø) ⬆️
... and 24 more

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 3af0537...9d48cf0. Read the comment docs.

@SimonSchick SimonSchick force-pushed the SimonSchick:chore/optimize branch from 6b0f6f0 to 72ecb9d Oct 29, 2018
lib/data-types.js Show resolved Hide resolved
lib/dialects/abstract/query.js Outdated Show resolved Hide resolved
lib/dialects/mssql/query.js Outdated Show resolved Hide resolved
lib/dialects/mssql/query.js Show resolved Hide resolved
lib/dialects/sqlite/query.js Outdated Show resolved Hide resolved
lib/model.js Outdated Show resolved Hide resolved
lib/model.js Outdated Show resolved Hide resolved
lib/utils.js Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
test/unit/sql/data-types.test.js Outdated Show resolved Hide resolved
@SimonSchick SimonSchick force-pushed the SimonSchick:chore/optimize branch from 29531a3 to b5fee4f Nov 1, 2018
@SimonSchick
Copy link
Member Author

@SimonSchick SimonSchick commented Nov 1, 2018

Addressed all comments and squashed all commits since there isn't much point in keeping them separate anymore, waiting for CI build to pass now.

@SimonSchick
Copy link
Member Author

@SimonSchick SimonSchick commented Nov 2, 2018

@sushantdhiman we good now?

lib/model.js Outdated Show resolved Hide resolved
lib/model.js Outdated Show resolved Hide resolved
lib/utils.js Outdated Show resolved Hide resolved
@SimonSchick SimonSchick force-pushed the SimonSchick:chore/optimize branch from b5fee4f to 9d48cf0 Nov 3, 2018
@SimonSchick
Copy link
Member Author

@SimonSchick SimonSchick commented Nov 3, 2018

done

@sushantdhiman sushantdhiman merged commit 2507139 into sequelize:master Nov 4, 2018
1 of 2 checks passed
1 of 2 checks passed
continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
@sushantdhiman
Copy link
Contributor

@sushantdhiman sushantdhiman commented Nov 4, 2018

Thanks @SimonSchick

@SimonSchick SimonSchick mentioned this pull request Nov 5, 2018
2 of 5 tasks complete
@SimonSchick SimonSchick deleted the SimonSchick:chore/optimize branch Mar 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants