[squid-dev] [PATCH] Remove some splay users

Amos Jeffries squid3 at treenet.co.nz
Tue Jan 13 02:09:37 UTC 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 13/01/2015 8:51 a.m., Kinkie wrote:
> Hello, the attached patch changes some users of splay to std::set.
> The aim is to get more predictable (if not necessarily better)
> performance and leverage a cleaner API resulting in more readable
> code.
> 
> This is a merge snapshot of branch lp:~squid/squid/replace-splay
> revno 13835; I will continue working on the branch to migrate more
> users.
> 
> The touched classes have been build- and run-tested.
> 


in src/acl/UserData.h, src/acl/Eui64.h, etc
* still need to include splay.h in these .h files?
  perhapse it can be reduced down to the relevant .cc or dropped entirely.


in src/acl/Eui64.cc:
* ACLEui64::parse() can be optimized a bit further:

   while (const char *t = ConfigParser::strtokFile()) {
    if (Eui::Eui64 *q = aclParseEuiData(t)) {
       ... what used to follow the if
       xfree(q);
    }
  }

* ACLEui64::dump() buf variable can remain as static. It's only used
until SBuf data-copies, no need to re-allocate on each loop.
 - also while changing, if possible use SZ_EUI64_BUF otherwise
document why magic number is 48 used. (EUI uses 3 readable characters
to represent each octet of the number - buf is approx. double the
required size).


in src/acl/UserData.cc:
* #include SbufAlgos.h before util.h

* for ctor/dtor like ACLUserData::~ACLUserData() which have become
NOP, please inline them in the .h where possible. That allows some
more compiler optimizations.

* is cend() usable instead of end() for the find test in the function
above ACLUserData::dump() [ chunk @55, I think its probably the end of
match()]

* why is CaseInsensitveSBufCompare() not defined in SBufAlgos.h for
re-use ?



Amos
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (MingW32)

iQEcBAEBAgAGBQJUtH5hAAoJELJo5wb/XPRjiiMIAJ8VxpagLh9PUIpOkhErqi+w
JJb/UBKY5yAWVB4C3gSMGGiYTFS47EqCc2loc4k5ciLJbknEwB4veuznUJFjIxZz
rPVClCP0V6jK/MUr9H9Rs0ZqIz7g8elxt8NxZeEKdfB0zgR5piVDjFAKtPlz6FWV
LlRFACmEV+KT+EyxXBLhaWaTagCq7kNTGl9HnR8esNsD8lKOy98f91+qhcyBMPDv
FnsiyqbrzzqPHCiCOPfHS4PR9AW+lTNZeRhvFSheIMz7/ugVwmk2dTjdrl9AP612
tWmaiaZPCqgzohLb4SpbEgX9hc7ywTzsG81yDfYL2VkIA02EO9hrUPHRj3KbKPo=
=KEur
-----END PGP SIGNATURE-----


More information about the squid-dev mailing list