不要怂,就是干,撸起袖子干!

Commit 3e2d7eb0 by Nate Silva Committed by Jan Aagaard Meier

performance: replace a critical usage of Array.concat with for loop/push (#7175)

* performance this Array.concat with for loop/push

for loop/push is much faster than Array.concat.
For the largest/ugliest queries, this can get
called hundreds of thousands of times, so the
performance difference does matter.

* add message to changelog.md
1 parent 6ff57f19
Showing with 5 additions and 1 deletions
# Future
- [PERFORMANCE] more efficient array handing for certain large queries [#7175](https://github.com/sequelize/sequelize/pull/7175)
- [FIXED] Add `unique` indexes defined via options to `rawAttributes` [#7196]
- [FIXED] Removed support where `order` value is string and interpreted as `Sequelize.literal()`. [#6935](https://github.com/sequelize/sequelize/issues/6935)
- [CHANGED] `DataTypes.DATE` to use `DATETIMEOFFSET` [MSSQL] [#5403](https://github.com/sequelize/sequelize/issues/5403)
......
......@@ -1591,7 +1591,10 @@ class Model {
// Force array so we can concat no matter if it's 1:1 or :M
if (!Array.isArray(associations)) associations = [associations];
return memo.concat(associations);
for (let i = 0, len = associations.length; i !== len; ++i) {
memo.push(associations[i]);
}
return memo;
}, []),
_.assign(
{},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!