[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnutls-dev] future optimizations
From: |
Nikos Mavroyanopoulos |
Subject: |
[gnutls-dev] future optimizations |
Date: |
Mon Mar 25 20:17:01 2002 |
User-agent: |
Mutt/1.3.27i |
Although it's too soon for this, I've been doing some profiling tests with the
current version of gnutls (server). As I was expecting it, the RSA
(DHE_RSA is much slower[0]) calculation has a great percentence of the total
server time (65%).
Other than that I discovered that the _gnutls_supported_ciphersuites()[1]
function took about 8% of the time. This is because the priority in
gnutls is set per state, and it involves algorithms instead of TLS
cipher suites. Unfortunately this cannot be optimized unless I change
the way gnutls_*_priority work, thus I think it'd be better to postpone
it for a future release (0.5.0 probably, but I haven't made my mind yet).
Other possible optimizations might be using alloca() instead of
malloc() in some functions, but I do not know how portable is it.
In any case we seem to have about the 1/10 of the openssl speed[2]
in the (server side) handshake procedure, thus we need a lot of work.
[0]. There are optimizations though (such as precalculating the signature),
which are easy to add, and will be added soon after 0.4.0.
[1]. This one calls _gnutls_cipher_suite_count() and
_gnutls_cipher_suite_is_ok()
many times.
[2]. This is only in single threaded servers, but I'm not sure if the server
type was the same (gnutls was running in a non blocking server, openssl was used
with the included s_server command).
I attach the output of fcdump.
FunctionCheck V3.0 by Y.Perret
Total time spend in this processus is 583.099597
606 arc(s), 304 function(s) (304 shown, 0 hidden), 6 library(ies)
total | local | total | local | # |function
time | % | time | % | min | max | min | max | calls | name
-------|-----|-------|-----|-------|-------|-------|-------|-------|--------
583.07|100.0| 3.68| 0.6| 583.07| 583.07| 3.68| 3.68| 1| main
542.50| 93.0| 0.27| 0.0| 0.03| 0.31| 0.00| 0.00| 2562|
gnutls_handshake
475.18| 81.5| 0.45| 0.1| 0.03| 0.28| 0.00| 0.00| 2562|
gnutls_handshake_server
391.93| 67.2| 0.16| 0.0| 0.15| 0.22| 0.00| 0.00| 2561|
_gnutls_recv_client_kx_message
386.49| 66.3| 0.26| 0.0| 0.15| 0.22| 0.00| 0.00| 2561|
proc_rsa_client_kx
385.13| 66.0| 0.39| 0.1| 0.15| 0.22| 0.00| 0.00| 2561|
_gnutls_pkcs1_rsa_decrypt
383.13| 65.7| 377.73| 64.8| 0.14| 0.22| 0.14| 0.22| 2561|
_gnutls_pk_encrypt
72.68| 12.5| 0.59| 0.1| 0.00| 0.09| 0.00| 0.00| 7684|
_gnutls_recv_handshake
66.08| 11.3| 0.20| 0.0| 0.02| 0.09| 0.00| 0.00| 2561|
gnutls_handshake_common
53.33| 9.1| 0.07| 0.0| 0.01| 0.09| 0.00| 0.00| 2562|
_gnutls_recv_hello
53.26| 9.1| 0.46| 0.1| 0.01| 0.09| 0.00| 0.00| 2562|
_gnutls_read_client_hello
47.87| 8.2| 0.33| 0.1| 0.01| 0.09| 0.00| 0.00| 2561|
_gnutls_server_select_suite
44.98| 7.7| 2.81| 0.5| 0.00| 0.07| 0.00| 0.00| 17922|
gnutls_send_int
44.46| 7.6| 0.20| 0.0| 0.02| 0.08| 0.00| 0.00| 2561|
_gnutls_recv_handshake_final
44.09| 7.6| 3.11| 0.5| 0.01| 0.08| 0.00| 0.02| 2561|
_gnutls_supported_ciphersuites
37.75| 6.5| 18.35| 3.1| 0.01| 0.08| 0.00| 0.07| 2561|
_gnutls_cipher_suite_count
26.13| 4.5| 0.89| 0.2| 0.00| 0.07| 0.00| 0.00| 10244|
_gnutls_send_handshake
25.40| 4.4| 15.69| 2.7| 0.00| 0.04| 0.00| 0.04| 524957| gnutls_free
25.04| 4.3| 3.15| 0.5| 0.00| 0.07| 0.00| 0.00| 30731|
gnutls_recv_int
22.77| 3.9| 0.47| 0.1| 0.00| 0.05| 0.00| 0.00| 5122|
gnutls_ssl3_generate_random
22.45| 3.8| 7.04| 1.2| 0.00| 0.04| 0.00| 0.04| 92184|
gnutls_hash_deinit
22.23| 3.8| 2.15| 0.4| 0.00| 0.04| 0.00| 0.00| 20488| ssl3_md5
21.96| 3.8| 0.30| 0.1| 0.00| 0.07| 0.00| 0.00| 10244|
_gnutls_handshake_io_send_int
21.75| 3.7| 0.82| 0.1| 0.00| 0.02| 0.00| 0.00| 17922|
_gnutls_io_write_buffered2
20.93| 3.6| 20.93| 3.6| 0.00| 0.02| 0.00| 0.02| 17922|
_gnutls_io_write_buffered
20.38| 3.5| 0.41| 0.1| 0.01| 0.02| 0.00| 0.00| 2558|
listener_free
19.41| 3.3| 19.41| 3.3| 0.00| 0.01| 0.00| 0.01|1311232|
_gnutls_cipher_suite_is_ok
18.17| 3.1| 0.17| 0.0| 0.01| 0.07| 0.00| 0.00| 2561|
_gnutls_send_handshake_final
17.95| 3.1| 0.64| 0.1| 0.01| 0.05| 0.00| 0.00| 2561|
_gnutls_read_connection_state_init
17.50| 3.0| 1.02| 0.2| 0.00| 0.07| 0.00| 0.00| 17922|
_gnutls_encrypt
15.96| 2.7| 3.71| 0.6| 0.00| 0.07| 0.00| 0.00| 17922|
_gnutls_compressed2TLSCiphertext
15.74| 2.7| 0.58| 0.1| 0.00| 0.07| 0.00| 0.00| 23052|
_gnutls_handshake_io_recv_int
15.67| 2.7| 0.20| 0.0| 0.01| 0.05| 0.00| 0.00| 2561|
_gnutls_set_read_keys
15.40| 2.6| 0.36| 0.1| 0.00| 0.05| 0.00| 0.00| 5122|
_gnutls_set_keys
14.62| 2.5| 0.40| 0.1| 0.00| 0.07| 0.00| 0.00| 7684|
_gnutls_recv_handshake_header
14.56| 2.5| 0.24| 0.0| 0.01| 0.07| 0.00| 0.00| 2561|
_gnutls_recv_finished
14.20| 2.4| 0.10| 0.0| 0.01| 0.01| 0.00| 0.00| 2558| gnutls_bye
14.10| 2.4| 0.10| 0.0| 0.00| 0.01| 0.00| 0.00| 2558|
gnutls_alert_send
12.37| 2.1| 0.21| 0.0| 0.00| 0.07| 0.00| 0.00| 2561|
_gnutls_send_finished
11.75| 2.0| 8.69| 1.5| 0.00| 0.06| 0.00| 0.06| 99870|
gnutls_hash_init
11.19| 1.9| 0.49| 0.1| 0.00| 0.07| 0.00| 0.00| 12805|
_gnutls_decrypt
11.13| 1.9| 1.92| 0.3| 0.00| 0.04| 0.00| 0.00| 20488| ssl3_sha
10.95| 1.9| 0.56| 0.1| 0.00| 0.06| 0.00| 0.00| 5122|
_gnutls_ssl3_finished
10.77| 1.8| 1.64| 0.3| 0.00| 0.00| 0.00| 0.00| 12799|
gnutls_mac_deinit_ssl3
10.53| 1.8| 2.53| 0.4| 0.00| 0.07| 0.00| 0.06| 12805|
_gnutls_ciphertext2TLSCompressed
10.50| 1.8| 0.07| 0.0| 0.00| 0.04| 0.00| 0.00| 2561|
_gnutls_send_empty_handshake
9.31| 1.6| 0.08| 0.0| 0.00| 0.01| 0.00| 0.00| 2561|
_gnutls_connection_state_init
9.29| 1.6| 1.65| 0.3| 0.00| 0.06| 0.00| 0.00| 10244|
gnutls_mac_deinit_ssl3_handshake
9.23| 1.6| 0.08| 0.0| 0.00| 0.01| 0.00| 0.00| 2561|
_gnutls_generate_master
9.15| 1.6| 0.16| 0.0| 0.00| 0.01| 0.00| 0.00| 2561|
generate_normal_master
7.61| 1.3| 0.17| 0.0| 0.00| 0.07| 0.00| 0.00| 5118|
gnutls_record_recv
6.67| 1.1| 0.07| 0.0| 0.00| 0.07| 0.00| 0.00| 2561|
_gnutls_send_hello
6.65| 1.1| 0.15| 0.0| 0.00| 0.07| 0.00| 0.03| 2559|
gnutls_record_send
6.60| 1.1| 0.29| 0.0| 0.00| 0.07| 0.00| 0.00| 2561|
_gnutls_send_server_hello
6.56| 1.1| 0.15| 0.0| 0.00| 0.01| 0.00| 0.00| 2561|
_gnutls_send_server_certificate
6.47| 1.1| 6.47| 1.1| 0.00| 0.04| 0.00| 0.04| 507625|
gnutls_malloc
5.78| 1.0| 1.45| 0.2| 0.00| 0.02| 0.00| 0.00| 2558|
gnutls_deinit
5.61| 1.0| 5.61| 1.0| 0.00| 0.00| 0.00| 0.00| 263753| gnutls_hash
5.29| 0.9| 5.29| 0.9| 0.00| 0.02| 0.00| 0.02| 512151|
_gnutls_free
4.87| 0.8| 4.87| 0.8| 0.00| 0.00| 0.00| 0.00| 507047|
_gnutls_is_secure_memory
3.76| 0.6| 3.37| 0.6| 0.00| 0.04| 0.00| 0.03| 5123|
_gnutls_get_random
3.74| 0.6| 1.22| 0.2| 0.00| 0.00| 0.00| 0.00| 30727|
gnutls_mac_init_ssl3
3.11| 0.5| 1.22| 0.2| 0.00| 0.06| 0.00| 0.00| 28168|
_gnutls_io_read_buffered
2.90| 0.5| 0.09| 0.0| 0.00| 0.00| 0.00| 0.00| 2561|
_gnutls_send_change_cipher_spec
2.83| 0.5| 1.21| 0.2| 0.00| 0.00| 0.00| 0.00| 30731|
_gnutls_check_buffers
2.73| 0.5| 0.66| 0.1| 0.00| 0.00| 0.00| 0.00| 2561|
_gnutls_write_connection_state_init
2.58| 0.4| 0.46| 0.1| 0.00| 0.05| 0.00| 0.00| 2561|
_gnutls_remove_unwanted_ciphersuites
2.29| 0.4| 0.12| 0.0| 0.00| 0.03| 0.00| 0.00| 2562|
_gnutls_create_random
2.13| 0.4| 0.58| 0.1| 0.00| 0.00| 0.00| 0.00| 10244|
_gnutls_handshake_hash_add_sent
2.07| 0.4| 1.41| 0.2| 0.00| 0.06| 0.00| 0.06| 53780|
gnutls_realloc_fast
2.07| 0.4| 0.40| 0.1| 0.00| 0.00| 0.00| 0.00| 7684|
_gnutls_handshake_hash_add_recvd
2.01| 0.3| 0.65| 0.1| 0.00| 0.00| 0.00| 0.00| 23025|
gnutls_sfree_datum
1.99| 0.3| 0.92| 0.2| 0.00| 0.07| 0.00| 0.06| 2561|
_gnutls_gen_extensions
1.99| 0.3| 1.06| 0.2| 0.00| 0.00| 0.00| 0.00| 20489|
_gnutls_handshake_hash_pending
1.90| 0.3| 1.90| 0.3| 0.00| 0.00| 0.00| 0.00| 112672|
gnutls_hash_get_algo_len
1.86| 0.3| 0.89| 0.2| 0.00| 0.02| 0.00| 0.02| 40953|
_gnutls_mpi_release
1.75| 0.3| 0.25| 0.0| 0.00| 0.00| 0.00| 0.00| 2561|
_gnutls_server_register_current_session
1.70| 0.3| 0.07| 0.0| 0.00| 0.04| 0.00| 0.00| 2561|
_gnutls_generate_session_id
1.66| 0.3| 0.70| 0.1| 0.00| 0.00| 0.00| 0.00| 25612|
_gnutls_record_buffer_get
1.55| 0.3| 0.72| 0.1| 0.00| 0.00| 0.00| 0.00| 20471|
gnutls_secure_free
1.53| 0.3| 0.37| 0.1| 0.00| 0.00| 0.00| 0.00| 2563|
initialize_state
1.50| 0.3| 0.17| 0.0| 0.00| 0.00| 0.00| 0.00| 2561|
_gnutls_handshake_hash_buffers_clear
1.19| 0.2| 1.19| 0.2| 0.00| 0.07| 0.00| 0.07| 51196| gnutls_hmac
1.18| 0.2| 0.54| 0.1| 0.00| 0.00| 0.00| 0.00| 17927|
gnutls_sset_datum
1.04| 0.2| 1.04| 0.2| 0.00| 0.00| 0.00| 0.00| 74258|
gnutls_protocol_get_version
1.03| 0.2| 0.46| 0.1| 0.00| 0.04| 0.00| 0.04| 2561|
_gnutls_cert_supported_kx
0.97| 0.2| 0.97| 0.2| 0.00| 0.00| 0.00| 0.00| 66586|
_gnutls_cipher_suite_get_kx_algo
0.95| 0.2| 0.95| 0.2| 0.00| 0.00| 0.00| 0.00| 69147|
_gnutls_cipher_suite_get_version
0.94| 0.2| 0.55| 0.1| 0.00| 0.00| 0.00| 0.00| 10244|
gnutls_hash_copy
0.94| 0.2| 0.40| 0.1| 0.00| 0.00| 0.00| 0.00| 15368|
_gnutls_handshake_buffer_put
0.93| 0.2| 0.62| 0.1| 0.00| 0.00| 0.00| 0.00| 25613|
gnutls_datum_append
0.93| 0.2| 0.26| 0.0| 0.00| 0.00| 0.00| 0.00| 10244|
_gnutls_record_check_type
0.87| 0.1| 0.07| 0.0| 0.00| 0.00| 0.00| 0.00| 2561|
_gnutls_gen_cert_server_certificate
0.87| 0.1| 0.87| 0.1| 0.00| 0.00| 0.00| 0.00| 74251|
_gnutls_malloc_ptr_size
0.85| 0.1| 0.10| 0.0| 0.00| 0.00| 0.00| 0.00| 2562|
_gnutls_handshake_hash_init
0.83| 0.1| 0.49| 0.1| 0.00| 0.00| 0.00| 0.00| 12805|
_gnutls_check_record_headers
0.80| 0.1| 0.19| 0.0| 0.00| 0.00| 0.00| 0.00| 2561|
_gnutls_gen_x509_certificate
0.79| 0.1| 0.75| 0.1| 0.00| 0.00| 0.00| 0.00| 33288|
_gnutls_read
0.73| 0.1| 0.29| 0.0| 0.00| 0.00| 0.00| 0.00| 2563| gnutls_init
0.73| 0.1| 0.50| 0.1| 0.00| 0.00| 0.00| 0.00| 20489|
gnutls_secure_malloc
0.72| 0.1| 0.22| 0.0| 0.00| 0.00| 0.00| 0.00| 2561|
_gnutls_session_pack
0.71| 0.1| 0.64| 0.1| 0.00| 0.00| 0.00| 0.00| 5122|
gnutls_cipher_init
0.70| 0.1| 0.70| 0.1| 0.00| 0.00| 0.00| 0.00| 51210|
_gnutls_version_get_major
0.69| 0.1| 0.69| 0.1| 0.00| 0.00| 0.00| 0.00| 51210|
_gnutls_version_get_minor
0.69| 0.1| 0.41| 0.1| 0.00| 0.00| 0.00| 0.00| 10244|
_gnutls_get_kx_cred
0.68| 0.1| 0.68| 0.1| 0.00| 0.00| 0.00| 0.00| 53782|
_gnutls_record_buffer_get_size
0.67| 0.1| 0.67| 0.1| 0.00| 0.07| 0.00| 0.07| 43537|
_gnutls_ext_func_send
0.67| 0.1| 0.27| 0.0| 0.00| 0.00| 0.00| 0.00| 10244|
_gnutls_record_buffer_put
0.67| 0.1| 0.67| 0.1| 0.00| 0.00| 0.00| 0.00| 48659|
_gnutls_kx_priority
0.64| 0.1| 0.64| 0.1| 0.00| 0.00| 0.00| 0.00| 43548|
gnutls_realloc
0.63| 0.1| 0.42| 0.1| 0.00| 0.00| 0.00| 0.00| 15366| WRITEuint24
0.63| 0.1| 0.26| 0.0| 0.00| 0.00| 0.00| 0.00| 5116|
gnutls_comp_deinit
0.61| 0.1| 0.41| 0.1| 0.00| 0.00| 0.00| 0.00| 20471|
_gnutls_secure_ptr_size
0.59| 0.1| 0.59| 0.1| 0.00| 0.00| 0.00| 0.00| 46095|
_gnutls_session_is_valid
0.57| 0.1| 0.57| 0.1| 0.00| 0.00| 0.00| 0.00| 40971|
_gnutls_mac_get_digest_size
0.50| 0.1| 0.50| 0.1| 0.00| 0.06| 0.00| 0.06| 30727| CONVuint64
0.49| 0.1| 0.14| 0.0| 0.00| 0.00| 0.00| 0.00| 2561|
_gnutls_server_select_comp_method
0.48| 0.1| 0.48| 0.1| 0.00| 0.00| 0.00| 0.00| 33286|
_gnutls_cipher_is_block
0.46| 0.1| 0.31| 0.1| 0.00| 0.00| 0.00| 0.00| 12805|
_gnutls_check_record_version
0.46| 0.1| 0.17| 0.0| 0.00| 0.00| 0.00| 0.00| 2561|
_gnutls_session_size
0.46| 0.1| 0.25| 0.0| 0.00| 0.00| 0.00| 0.00| 2561|
_gnutls_find_pk_algos_in_ciphersuites
0.43| 0.1| 0.43| 0.1| 0.00| 0.00| 0.00| 0.00| 30727|
_gnutls_cipher_get_block_size
0.43| 0.1| 0.34| 0.1| 0.00| 0.00| 0.00| 0.00| 17922|
_gnutls_create_empty_record
0.43| 0.1| 0.43| 0.1| 0.00| 0.00| 0.00| 0.00| 30732|
_gnutls_map_kx_get_cred
0.42| 0.1| 0.42| 0.1| 0.00| 0.00| 0.00| 0.00| 30727| CONVuint16
0.42| 0.1| 0.25| 0.0| 0.00| 0.00| 0.00| 0.00| 5122|
gnutls_auth_get_type
0.40| 0.1| 0.24| 0.0| 0.00| 0.00| 0.00| 0.00| 5122|
_gnutls_set_kx
0.40| 0.1| 0.40| 0.1| 0.00| 0.00| 0.00| 0.00| 28166| uint64pp
0.39| 0.1| 0.15| 0.0| 0.00| 0.00| 0.00| 0.00| 5116|
gnutls_cipher_deinit
0.38| 0.1| 0.38| 0.1| 0.00| 0.00| 0.00| 0.00| 17922|
gnutls_cipher_encrypt
[...]
--
Nikos Mavroyanopoulos
mailto:address@hidden
- [gnutls-dev] future optimizations,
Nikos Mavroyanopoulos <=