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

Performance improvement 12: Optimize NocaseDict._real_key() #1673

Merged
merged 3 commits into from
Mar 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
10420503 function calls (10180498 primitive calls) in 6.269 seconds

Ordered by: internal time, call count
List reduced from 159 to 25 due to restriction <25>

ncalls tottime percall cumtime percall filename:lineno(function)
80000 0.829 0.000 1.218 0.000 collections.py:50(__init__)
140005 0.420 0.000 0.681 0.000 tupleparse.py:165(check_node)
140005 0.369 0.000 0.448 0.000 tupletree.py:96(startElement)
1800019 0.279 0.000 0.279 0.000 {isinstance}
92 0.277 0.003 1.285 0.014 {built-in method Parse}
80000 0.269 0.000 0.283 0.000 _abcoll.py:548(update)
80000 0.199 0.000 1.534 0.000 _nocasedict.py:90(__init__)
250005 0.188 0.000 0.270 0.000 tupleparse.py:117(kids)
120004/1 0.174 0.000 4.976 4.976 tupleparse.py:2057(parse_any)
100000/20000 0.162 0.000 2.826 0.000 tupleparse.py:323(list_of_matching)
40000 0.160 0.000 1.338 0.000 cim_obj.py:4324(__init__)
30000 0.160 0.000 1.904 0.000 tupleparse.py:1318(parse_property)
300007 0.121 0.000 0.176 0.000 tupletree.py:115(characters)
140005 0.106 0.000 0.575 0.000 expatreader.py:335(start_element)
260000 0.077 0.000 0.131 0.000 _utils.py:41(_ensure_unicode)
80000 0.074 0.000 0.100 0.000 _nocasedict.py:377(update)
40000 0.074 0.000 0.672 0.000 tupleparse.py:2147(unpack_value)
570010 0.071 0.000 0.071 0.000 {method 'append' of 'list' objects}
300007 0.070 0.000 0.246 0.000 pyexpat.c:441(CharacterData)
10000 0.068 0.000 3.735 0.000 tupleparse.py:1128(parse_instance)
40000 0.066 0.000 0.249 0.000 cim_obj.py:2635(__setitem__)
20000 0.066 0.000 0.615 0.000 cim_obj.py:1252(keybindings)
80000 0.063 0.000 0.099 0.000 abc.py:148(__subclasscheck__)
60000 0.060 0.000 0.060 0.000 collections.py:71(__setitem__)
10000 0.059 0.000 0.677 0.000 tupleparse.py:1375(parse_property_array)


Results: profile=cprofile, response_counts=[10000],
response-sizes=[500], 20190302-113737
+----------------+----------------+------------+--------------+
| Exp Response | Act Response | Response | Parse time |
| Size Bytes | Size (Bytes) | Count | sec.) |
+================+================+============+==============+
| 500 | 589 | 10000 | 6.34977 |
+----------------+----------------+------------+--------------+
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@

_ ._ __/__ _ _ _ _ _/_ Recorded: 11:38:37 Samples: 2737
/_//_/// /_\ / //_// / //_'/ // Duration: 5.494
/ _/ v3.0.1

Program: tests/manualtest/run_response_performance.py -i -c 1000 10000 -s 500 -n 25 -l -p pyinst -r 10-checkarray

5.494 execute_test_code run_response_performance.py:192
├─ 4.275 parse_cim pywbem/tupleparse.py:384
│ └─ 4.275 one_child pywbem/tupleparse.py:250
│ └─ 4.275 parse_any pywbem/tupleparse.py:2057
│ └─ 4.275 parse_message pywbem/tupleparse.py:1631
│ └─ 4.275 one_child pywbem/tupleparse.py:250
│ └─ 4.275 parse_any pywbem/tupleparse.py:2057
│ └─ 4.275 parse_simplersp pywbem/tupleparse.py:1892
│ └─ 4.275 one_child pywbem/tupleparse.py:250
│ └─ 4.275 parse_any pywbem/tupleparse.py:2057
│ └─ 4.275 parse_imethodresponse pywbem/tupleparse.py:1947
│ └─ 4.275 list_of_various pywbem/tupleparse.py:302
│ └─ 4.275 parse_any pywbem/tupleparse.py:2057
│ └─ 4.275 parse_ireturnvalue pywbem/tupleparse.py:2014
│ └─ 4.267 list_of_same pywbem/tupleparse.py:339
│ └─ 4.248 parse_any pywbem/tupleparse.py:2057
│ └─ 4.218 parse_value_namedinstance pywbem/tupleparse.py:538
│ ├─ 3.166 parse_instance pywbem/tupleparse.py:1128
│ │ ├─ 2.585 list_of_matching pywbem/tupleparse.py:323
│ │ │ └─ 2.499 parse_any pywbem/tupleparse.py:2057
│ │ │ ├─ 1.773 parse_property pywbem/tupleparse.py:1318
│ │ │ │ ├─ 1.140 __init__ pywbem/cim_obj.py:4324
│ │ │ │ │ ├─ 0.849 qualifiers pywbem/cim_obj.py:4789
│ │ │ │ │ │ └─ 0.830 __init__ pywbem/_nocasedict.py:90
│ │ │ │ │ │ ├─ 0.570 __init__ collections.py:50
│ │ │ │ │ │ │ [8 frames hidden] collections, _abcoll, abc, _weakrefset
│ │ │ │ │ │ └─ 0.238 [self] 
│ │ │ │ │ └─ 0.085 [self] 
│ │ │ │ ├─ 0.334 unpack_value pywbem/tupleparse.py:2147
│ │ │ │ │ ├─ 0.171 list_of_matching pywbem/tupleparse.py:323
│ │ │ │ │ │ └─ 0.138 parse_any pywbem/tupleparse.py:2057
│ │ │ │ │ │ └─ 0.102 parse_value pywbem/tupleparse.py:450
│ │ │ │ │ │ └─ 0.057 check_node pywbem/tupleparse.py:165
│ │ │ │ │ └─ 0.109 unpack_single_value pywbem/tupleparse.py:2178
│ │ │ │ │ └─ 0.073 unpack_numeric pywbem/tupleparse.py:2291
│ │ │ │ ├─ 0.138 check_node pywbem/tupleparse.py:165
│ │ │ │ │ └─ 0.120 [self] 
│ │ │ │ └─ 0.108 [self] 
│ │ │ ├─ 0.636 parse_property_array pywbem/tupleparse.py:1375
│ │ │ │ ├─ 0.258 unpack_value pywbem/tupleparse.py:2147
│ │ │ │ │ └─ 0.245 list_of_matching pywbem/tupleparse.py:323
│ │ │ │ │ └─ 0.226 parse_any pywbem/tupleparse.py:2057
│ │ │ │ │ └─ 0.216 parse_value_array pywbem/tupleparse.py:469
│ │ │ │ │ └─ 0.188 list_of_various pywbem/tupleparse.py:302
│ │ │ │ │ └─ 0.175 parse_any pywbem/tupleparse.py:2057
│ │ │ │ │ └─ 0.160 parse_value pywbem/tupleparse.py:450
│ │ │ │ │ └─ 0.128 check_node pywbem/tupleparse.py:165
│ │ │ │ │ └─ 0.121 kids pywbem/tupleparse.py:117
│ │ │ │ ├─ 0.212 __init__ pywbem/cim_obj.py:4324
│ │ │ │ │ └─ 0.110 qualifiers pywbem/cim_obj.py:4789
│ │ │ │ │ └─ 0.107 __init__ pywbem/_nocasedict.py:90
│ │ │ │ │ └─ 0.067 __init__ collections.py:50
│ │ │ │ │ [8 frames hidden] collections, _abcoll, abc, _weakrefset
│ │ │ │ ├─ 0.095 check_node pywbem/tupleparse.py:165
│ │ │ │ │ └─ 0.082 [self] 
│ │ │ │ └─ 0.055 [self] 
│ │ │ └─ 0.090 [self] 
│ │ ├─ 0.224 __init__ pywbem/cim_obj.py:2253
│ │ │ ├─ 0.104 properties pywbem/cim_obj.py:2405
│ │ │ │ └─ 0.098 __init__ pywbem/_nocasedict.py:90
│ │ │ │ └─ 0.069 __init__ collections.py:50
│ │ │ │ [8 frames hidden] collections, _abcoll, abc, _weakrefset
│ │ │ └─ 0.088 qualifiers pywbem/cim_obj.py:2460
│ │ │ └─ 0.081 __init__ pywbem/_nocasedict.py:90
│ │ ├─ 0.207 __setitem__ pywbem/cim_obj.py:2635
│ │ │ ├─ 0.081 __setitem__ pywbem/_nocasedict.py:231
│ │ │ └─ 0.066 [self] 
│ │ ├─ 0.078 check_node pywbem/tupleparse.py:165
│ │ │ └─ 0.063 [self] 
│ │ └─ 0.059 [self] 
│ ├─ 0.556 path pywbem/cim_obj.py:2499
│ │ └─ 0.554 copy pywbem/cim_obj.py:1438
│ │ └─ 0.541 __init__ pywbem/cim_obj.py:1102
│ │ └─ 0.517 keybindings pywbem/cim_obj.py:1252
│ │ ├─ 0.384 __init__ pywbem/_nocasedict.py:90
│ │ │ ├─ 0.298 [self] 
│ │ │ └─ 0.082 __init__ collections.py:50
│ │ │ [8 frames hidden] collections, abc, _weakrefset, _abcoll
│ │ └─ 0.071 items pywbem/_nocasedict.py:313
│ └─ 0.430 parse_instancename pywbem/tupleparse.py:942
│ ├─ 0.189 list_of_various pywbem/tupleparse.py:302
│ │ └─ 0.170 parse_any pywbem/tupleparse.py:2057
│ │ └─ 0.146 parse_keybinding pywbem/tupleparse.py:1013
│ │ └─ 0.087 one_child pywbem/tupleparse.py:250
│ │ └─ 0.082 parse_any pywbem/tupleparse.py:2057
│ │ └─ 0.070 parse_keyvalue pywbem/tupleparse.py:1034
│ └─ 0.158 __init__ pywbem/cim_obj.py:1102
│ └─ 0.139 keybindings pywbem/cim_obj.py:1252
│ └─ 0.089 __init__ pywbem/_nocasedict.py:90
│ └─ 0.057 __init__ collections.py:50
│ [8 frames hidden] collections, abc, _weakrefset, _abcoll
└─ 1.166 xml_to_tupletree_sax pywbem/tupletree.py:125
└─ 1.157 parseString xml/sax/__init__.py:35
[5 frames hidden] xml
1.157 feed xml/sax/expatreader.py:209
├─ 0.631 StartElement ../../../../../private/tmp/python@2-20190212-94033-m4zuyi/Python-2.7.15/Modules/pyexpat.c:566
│ └─ 0.603 start_element xml/sax/expatreader.py:335
│ [4 frames hidden] xml
│ 0.493 startElement pywbem/tupletree.py:96
│ └─ 0.444 [self] 
├─ 0.209 CharacterData ../../../../../private/tmp/python@2-20190212-94033-m4zuyi/Python-2.7.15/Modules/pyexpat.c:441
│ └─ 0.169 characters pywbem/tupletree.py:115
└─ 0.098 EndElement ../../../../../private/tmp/python@2-20190212-94033-m4zuyi/Python-2.7.15/Modules/pyexpat.c:618
└─ 0.085 end_element xml/sax/expatreader.py:338
[2 frames hidden] xml
0.059 endElement pywbem/tupletree.py:111


Results: profile=pyinst, response_counts=[10000],
response-sizes=[500], 20190302-113811
+----------------+----------------+------------+--------------+
| Exp Response | Act Response | Response | Parse time |
| Size Bytes | Size (Bytes) | Count | sec.) |
+================+================+============+==============+
| 500 | 589 | 10000 | 5.53824 |
+----------------+----------------+------------+--------------+
Loading