Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 72d813b6
authored
Aug 06, 2019
by
Chocobozzz
Committed by
Sushant
Aug 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: remove unnecessary cloneDeep calls (#11281)
1 parent
9bc6d425
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
10 deletions
lib/associations/has-many.js
lib/model.js
lib/query-interface.js
lib/associations/has-many.js
View file @
72d813b
...
...
@@ -180,7 +180,7 @@ class HasMany extends Association {
instances
=
undefined
;
}
options
=
Utils
.
cloneDeep
(
options
);
options
=
Object
.
assign
({},
options
);
if
(
this
.
scope
)
{
Object
.
assign
(
where
,
this
.
scope
);
...
...
lib/model.js
View file @
72d813b
...
...
@@ -1689,7 +1689,6 @@ class Model {
this
.
warnOnInvalidOptions
(
options
,
Object
.
keys
(
this
.
rawAttributes
));
const
tableNames
=
{};
let
originalOptions
;
tableNames
[
this
.
getTableName
(
options
)]
=
true
;
options
=
Utils
.
cloneDeep
(
options
);
...
...
@@ -1751,9 +1750,8 @@ class Model {
return
this
.
runHooks
(
'beforeFindAfterOptions'
,
options
);
}
}).
then
(()
=>
{
originalOptions
=
Utils
.
cloneDeep
(
options
);
options
.
tableNames
=
Object
.
keys
(
tableNames
);
return
this
.
QueryInterface
.
select
(
this
,
this
.
getTableName
(
options
),
options
);
const
selectOptions
=
Object
.
assign
({},
options
,
{
tableNames
:
Object
.
keys
(
tableNames
)
});
return
this
.
QueryInterface
.
select
(
this
,
this
.
getTableName
(
selectOptions
),
selectOptions
);
}).
tap
(
results
=>
{
if
(
options
.
hooks
)
{
return
this
.
runHooks
(
'afterFind'
,
results
,
options
);
...
...
@@ -1771,7 +1769,7 @@ class Model {
throw
new
sequelizeErrors
.
EmptyResultError
();
}
return
Model
.
_findSeparate
(
results
,
o
riginalO
ptions
);
return
Model
.
_findSeparate
(
results
,
options
);
});
}
...
...
lib/query-interface.js
View file @
72d813b
...
...
@@ -1112,10 +1112,8 @@ class QueryInterface {
);
}
select
(
model
,
tableName
,
options
)
{
options
=
Utils
.
cloneDeep
(
options
);
options
.
type
=
QueryTypes
.
SELECT
;
options
.
model
=
model
;
select
(
model
,
tableName
,
optionsArg
)
{
const
options
=
Object
.
assign
({},
optionsArg
,
{
type
:
QueryTypes
.
SELECT
,
model
});
return
this
.
sequelize
.
query
(
this
.
QueryGenerator
.
selectQuery
(
tableName
,
options
,
model
),
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment