]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/resolve/resolved-manager.h
resolved: keep addresses mapped to ::0 in a separate set
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 31 Jul 2018 13:09:13 +0000 (15:09 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 1 Aug 2018 10:38:39 +0000 (12:38 +0200)
commitfd373593ba9b7c8426529623a803086038db4474
treeb5d952380527f8106b8bc313e447411a83d892e6
parent78fc21a11a5ac7e090b309ed89b264dddba3a122
resolved: keep addresses mapped to ::0 in a separate set

We'd store every 0.0.0.0 and ::0 entry as a structure without any addresses
allocated. This is a somewhat common use case, let's optimize it a bit.

This gives some memory savings and a bit faster response time too:
'time build/test-resolved-etc-hosts hosts' goes from 7.7s to 5.6s, and
memory use as reported by valgrind for ~10000 hosts is reduced
==18097==   total heap usage: 29,902 allocs, 29,902 frees, 2,136,437 bytes allocated
==18240==   total heap usage: 19,955 allocs, 19,955 frees, 1,556,021 bytes allocated

Also rename 'suppress' to 'found' (with reverse meaning). I think this makes
the intent clearer.
src/resolve/resolved-etc-hosts.c
src/resolve/resolved-manager.h
src/resolve/test-resolved-etc-hosts.c