]> git.ipfire.org Git - thirdparty/systemd.git/commit
resolved: when adding RR to an answer, avoid comparing keys twice
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 27 Feb 2019 09:37:40 +0000 (10:37 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 4 Mar 2019 14:53:37 +0000 (15:53 +0100)
commitdffb8277728b8052258bff49d7157fc4e326f88f
treeb5077a9103d04a69ef337a601cf541b60a34395b
parent51969a5893f0344bf4fa2122ac30476ac30b9468
resolved: when adding RR to an answer, avoid comparing keys twice

We'd call dns_resource_record_equal(), which calls dns_resource_key_equal()
internally, and then dns_resource_key_equal() a second time. Let's be
a bit smarter, and call dns_resource_key_equal() only once.

(before)
dns_resource_key_hash_func_count=514
dns_resource_key_compare_func_count=275
dns_resource_key_equal_count=62371
4.13s user 0.01s system 99% cpu 4.153 total

(after)
dns_resource_key_hash_func_count=514
dns_resource_key_compare_func_count=276
dns_resource_key_equal_count=31337
2.13s user 0.01s system 99% cpu 2.139 total
src/resolve/resolved-dns-answer.c
src/resolve/resolved-dns-packet.c