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
Contributor

@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 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.

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
Copy link
Contributor Author

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
Contributor Author

@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
Copy link
Contributor Author

done

@sushantdhiman sushantdhiman merged commit 2507139 into sequelize:master Nov 4, 2018
@sushantdhiman
Copy link
Contributor

Thanks @SimonSchick

@SimonSchick SimonSchick deleted the chore/optimize branch March 9, 2019 11:04
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