Open
Description
I used ldap3 to query the Active Directory but looks like the library costs lots of CPU times. So I integrate yappi into my code to collect the performance statistics.
My test is query 100 entries in the AD.
The statistics show get_config_parameter
costs ~15% (0.017240/0.114406) of the CPU time of the call.
I suppose it could be a good point to improve the performance by replacing the call of get_config_parameter
by directly accessing the configuration items.
Any thoughts of the idea?
Function stats for (ReceiverSocketThread) (12)
Clock type: CPU
Ordered by: totaltime, desc
name ncall tsub ttot tavg
..AsyncStrategy.decode_response_fast 106 0.000366 0.114406 0.001079
..result_entry_response_to_dict_fast 101 0.000457 0.113788 0.001127
..47 checked_attributes_to_dict_fast 101 0.004823 0.079967 0.000792
..ls/asn1.py:102 decode_message_fast 106 0.000547 0.047355 0.000447
../utils/asn1.py:113 decode_sequence 309.. 0.027678 0.046529 0.000015
..ard.py:196 format_attribute_values 1387 0.008512 0.046011 0.000033
../ldap3/utils/conv.py:35 to_unicode 2883 0.014900 0.037084 0.000013
..py:428 raw_attributes_to_dict_fast 101 0.003392 0.031977 0.000317
..s/ldap3/utils/ciDict.py:50 _ci_key 5548 0.013247 0.022348 0.000004
..sensitiveWithAliasDict.__getitem__ 2774 0.003523 0.018618 0.000007
..config.py:133 get_config_parameter 11734 0.014016 0.017240 0.000001
..59 CaseInsensitiveDict.__setitem__ 2774 0.004467 0.015698 0.000006
..sensitiveWithAliasDict.__getitem__ 2774 0.003977 0.015095 0.000005
..ensitiveWithAliasDict.__contains__ 1387 0.001781 0.011365 0.000008
..matters/standard.py:214 <listcomp> 1387 0.002180 0.008683 0.000006
../utils/asn1.py:84 compute_ber_size 6384 0.006823 0.006823 0.000001
..search.py:414 decode_raw_vals_fast 2774 0.003610 0.005884 0.000002
..dard.py:139 find_attribute_helpers 1387 0.003065 0.004364 0.000003
..s/ldap3/utils/asn1.py:189 get_byte 6496 0.003431 0.003431 0.000001
../ldap3/utils/asn1.py:192 get_bytes 6384 0.003328 0.003328 0.000001
..seInsensitiveWithAliasDict.__len__ 1387 0.001752 0.002531 0.000002
..operation/search.py:415 <listcomp> 2774 0.002274 0.002274 0.000001
..ls/asn1.py:148 decode_octet_string 3185 0.002023 0.002023 0.000001
..rs/formatters.py:81 format_uuid_le 100 0.000473 0.001905 0.000019
..matters.py:101 format_ad_timestamp 102 0.000415 0.001604 0.000016
..tters/formatters.py:369 format_sid 100 0.001048 0.001516 0.000015
..rs/formatters.py:36 format_unicode 1086 0.001195 0.001195 0.000001
..ython3.8/uuid.py:130 UUID.__init__ 100 0.000792 0.001150 0.000011
...py:405 AttributeTypeInfo.oid_info 1676 0.001097 0.001097 0.000001
..e.py:453 compute_ldap_message_size 125 0.000609 0.000821 0.000007
..py:35 CaseInsensitiveDict.__init__ 202 0.000424 0.000424 0.000002
..3/utils/asn1.py:139 decode_integer 109 0.000304 0.000416 0.000004
..thon3.8/ssl.py:1219 SSLSocket.recv 20 0.000063 0.000381 0.000019
..thon3.8/ssl.py:1090 SSLSocket.read 20 0.000052 0.000306 0.000015
..mezone.py:33 OffsetTzInfo.__init__ 102 0.000285 0.000285 0.000003
..python3.8/uuid.py:271 UUID.__str__ 100 0.000282 0.000282 0.000003
..rs/formatters.py:48 format_integer 300 0.000274 0.000274 0.000001
..re/timezone.py:52 OffsetTzInfo.dst 204 0.000185 0.000185 0.000001
..ldap3/utils/log.py:116 log_enabled 212 0.000130 0.000130 0.000001
..syncStrategy.set_event_for_message 2 0.000011 0.000099 0.000050
..thon3.8/threading.py:519 Event.set 2 0.000015 0.000089 0.000044
..n1.py:172 ldap_result_to_dict_fast 2 0.000012 0.000075 0.000037
..connection.py:510 Connection.usage 106 0.000069 0.000069 0.000001
..ezone.py:45 OffsetTzInfo.utcoffset 104 0.000067 0.000067 0.000001
..3/core/server.py:563 Server.schema 101 0.000066 0.000066 0.000001
..matters.py:336 format_ad_timedelta 1 0.000008 0.000061 0.000061
..eading.py:364 Condition.notify_all 2 0.000008 0.000060 0.000030