I use Sequelize for access to MySQL database. I have 9 models with avg 10 fields for each.
CPU Profiler give me next results:
ticks parent name
53712 41.8% /usr/local/bin/node
46539 86.6% /usr/local/bin/node
6498 14.0% LazyCompile: *assignValue /sequelize/node_modules/lodash/lodash.js:2183:25
3386 52.1% LazyCompile: *<anonymous> /sequelize/node_modules/lodash/lodash.js:2346:41
3214 94.9% LazyCompile: *arrayEach /sequelize/node_modules/lodash/lodash.js:468:21
3214 100.0% LazyCompile: *baseClone /sequelize/node_modules/lodash/lodash.js:2295:23
172 5.1% LazyCompile: ~arrayEach /sequelize/node_modules/lodash/lodash.js:468:21
172 100.0% LazyCompile: *baseClone /sequelize/node_modules/lodash/lodash.js:2295:23
1240 19.1% LazyCompile: *copyObject /sequelize/node_modules/lodash/lodash.js:4264:24
776 62.6% LazyCompile: *baseAssign /sequelize/node_modules/lodash/lodash.js:2236:24
776 100.0% LazyCompile: *baseClone /sequelize/node_modules/lodash/lodash.js:2295:23
313 25.2% LazyCompile: *<anonymous> /sequelize/node_modules/lodash/lodash.js:11929:47
313 100.0% LazyCompile: *<anonymous> /sequelize/node_modules/lodash/lodash.js:4319:27
113 9.1% LazyCompile: ~baseAssign /sequelize/node_modules/lodash/lodash.js:2236:24
113 100.0% LazyCompile: *baseClone /sequelize/node_modules/lodash/lodash.js:2295:23
38 3.1% LazyCompile: ~<anonymous> /sequelize/node_modules/lodash/lodash.js:11929:47
38 100.0% LazyCompile: *<anonymous> /sequelize/node_modules/lodash/lodash.js:4319:27
1109 17.1% LazyCompile: ~<anonymous> /sequelize/node_modules/lodash/lodash.js:11890:43
1084 97.7% LazyCompile: *<anonymous> /sequelize/node_modules/lodash/lodash.js:4319:27
1080 99.6% LazyCompile: *<anonymous> /sequelize/node_modules/lodash/lodash.js:10043:22
25 2.3% Handler: I
22 88.0% LazyCompile: *<anonymous> /sequelize/node_modules/lodash/lodash.js:10043:22
3 12.0% LazyCompile: ~<anonymous> /sequelize/node_modules/lodash/lodash.js:10043:22
419 6.4% LazyCompile: *<anonymous> /sequelize/node_modules/lodash/lodash.js:11890:43
419 100.0% LazyCompile: *<anonymous> /sequelize/node_modules/lodash/lodash.js:4319:27
419 100.0% LazyCompile: *<anonymous> /sequelize/node_modules/lodash/lodash.js:10043:22
336 5.2% LazyCompile: ~copyObject /sequelize/node_modules/lodash/lodash.js:4264:24
185 55.1% LazyCompile: *baseAssign /sequelize/node_modules/lodash/lodash.js:2236:24
185 100.0% LazyCompile: *baseClone /sequelize/node_modules/lodash/lodash.js:2295:23
83 24.7% LazyCompile: ~baseAssign /sequelize/node_modules/lodash/lodash.js:2236:24
83 100.0% LazyCompile: *baseClone /sequelize/node_modules/lodash/lodash.js:2295:23
53 15.8% LazyCompile: *<anonymous> /sequelize/node_modules/lodash/lodash.js:11929:47
53 100.0% LazyCompile: *<anonymous> /sequelize/node_modules/lodash/lodash.js:4319:27
15 4.5% LazyCompile: ~<anonymous> /sequelize/node_modules/lodash/lodash.js:11929:47
14 93.3% LazyCompile: *<anonymous> /sequelize/node_modules/lodash/lodash.js:4319:27
1 6.7% Handler: I
3847 8.3% LazyCompile: *isPlainObject /sequelize/node_modules/lodash/lodash.js:11274:27
3118 81.1% LazyCompile: *<anonymous> /sequelize/lib/utils.js:92:42
3117 100.0% LazyCompile: *baseClone /sequelize/node_modules/lodash/lodash.js:2295:23
2531 81.2% LazyCompile: *<anonymous> /sequelize/node_modules/lodash/lodash.js:2346:41
584 18.7% LazyCompile: *cloneDeepWith /sequelize/node_modules/lodash/lodash.js:10380:27
188 4.9% LazyCompile: *whereItemsQuery /sequelize/lib/dialects/abstract/query-generator.js:1957:28
49 26.1% LazyCompile: *<anonymous> /sequelize/lib/dialects/abstract/query-generator.js:2102:36
49 100.0% LazyCompile: *map native array.js:994:18
42 22.3% LazyCompile: *getWhereConditions /sequelize/lib/dialects/abstract/query-generator.js:2393:31
42 100.0% LazyCompile: *selectQuery /sequelize/lib/dialects/abstract/query-generator.js:1021:24
28 14.9% Stub: BinaryOpICWithAllocationSiteStub(ADD_CreateAllocationMementos:String*String->String) {21}
28 100.0% LazyCompile: *map native array.js:994:18
28 14.9% LazyCompile: ~getWhereConditions /sequelize/lib/dialects/abstract/query-generator.js:2393:31
27 96.4% LazyCompile: *selectQuery /sequelize/lib/dialects/abstract/query-generator.js:1021:24
1 3.6% LazyCompile: ~selectQuery /sequelize/lib/dialects/abstract/query-generator.js:1021:24
28 14.9% Handler: hasDuplicating {50}
28 100.0% LazyCompile: *map native array.js:994:18
11 5.9% Handler: _events {9}
11 100.0% LazyCompile: *map native array.js:994:18
111 2.9% LazyCompile: *conformInclude /sequelize/lib/model.js:266:24
40 36.0% LazyCompile: *<anonymous> /sequelize/lib/model.js:428:50
40 100.0% LazyCompile: *map native array.js:994:18
38 34.2% LazyCompile: *<anonymous> /sequelize/lib/model.js:257:49
38 100.0% LazyCompile: *map native array.js:994:18
12 10.8% LazyCompile: *map native array.js:994:18
12 100.0% LazyCompile: *validateIncludedElements /sequelize/lib/model.js:412:40
10 9.0% Handler: include {6}
10 100.0% LazyCompile: *map native array.js:994:18
7 6.3% LazyCompile: ~<anonymous> /sequelize/lib/model.js:428:50
7 100.0% LazyCompile: *map native array.js:994:18
4 3.6% LazyCompile: ~<anonymous> /sequelize/lib/model.js:257:49
4 100.0% LazyCompile: *map native array.js:994:18
77 2.0% LazyCompile: *mapOptionFieldNames /sequelize/lib/utils.js:128:32
66 85.7% LazyCompile: *mapFinderOptions /sequelize/lib/utils.js:111:29
66 100.0% LazyCompile: ~<anonymous> /sequelize/lib/model.js:1360:19
11 14.3% LazyCompile: ~mapFinderOptions /sequelize/lib/utils.js:111:29
11 100.0% LazyCompile: ~<anonymous> /sequelize/lib/model.js:1360:19
2615 5.6% LazyCompile: ~<anonymous> /sequelize/node_modules/lodash/lodash.js:14117:36
2609 99.8% LazyCompile: *apply /sequelize/node_modules/lodash/lodash.js:427:17
2609 100.0% LazyCompile: <anonymous> /sequelize/node_modules/lodash/lodash.js:14500:32
2592 99.3% LazyCompile: *<anonymous> /sequelize/node_modules/lodash/lodash.js:10043:22
...
17106 13.3% /lib/x86_64-linux-gnu/libc-2.23.so
12703 74.3% /usr/local/bin/node
4405 34.7% LazyCompile: *assignValue /opt/mydataspace/node_modules/sequelize/node_modules/lodash/lodash.js:2183:25
1932 43.9% LazyCompile: *<anonymous> /opt/mydataspace/node_modules/sequelize/node_modules/lodash/lodash.js:2346:41
1829 94.7% LazyCompile: *arrayEach /opt/mydataspace/node_modules/sequelize/node_modules/lodash/lodash.js:468:21
1829 100.0% LazyCompile: *baseClone /opt/mydataspace/node_modules/sequelize/node_modules/lodash/lodash.js:2295:23
103 5.3% LazyCompile: ~arrayEach /opt/mydataspace/node_modules/sequelize/node_modules/lodash/lodash.js:468:21
103 100.0% LazyCompile: *baseClone /opt/mydataspace/node_modules/sequelize/node_modules/lodash/lodash.js:2295:23
assignValue uses 14% of CPU, mainly in _.clone/cloneDeep method, isPlainObject uses 8%,....
Does this mean that Sequelize uses lodash not optimal? Is there a way to optimize CPU usage by Sequelize?
via FiftiN
No comments:
Post a Comment