On 14/10/10 22:04, Tsantilas Christos wrote:
> On 10/14/2010 12:58 AM, Amos Jeffries wrote:
>> On Wed, 13 Oct 2010 16:25:34 +0300, Tsantilas Christos
>> <chtsanti_at_users.sourceforge.net> wrote:
>> .....
>>>
>>>>
>>>> * Can FileNameHashCached() be made a private static method of
>>>> TextException and work with the file and line details passed in to
>>>> cnstructor please?
>>> Will not work Amos.
>>
>> Ah I overlooked the static local.
>>
>> FileNameHash() could still be a member, but protected with friend
>> function
>> FileNameHashCached().
>>
>>>> The singleton hack making local copies in almost every file .o is
>> likely
>>>> to symbol clash on the more picky compilers like MacOSX.
>>>
>>> We need a copy of the FileNameHashCached in each .o file, which will
>>> compute and cache once the hash of its filename. Alternatively we can
>>> compute the hash when the Must exception called (direct use of the
>>> FileNameHash).
>>
>> IMO that would be better. A system throwing and failing a lot of Must()
>> requirements has worse problems than a few cycles of hashing.
> Probably you are right here. In the other hand some thousands of
> transactions aborted the same time for the same reason, will cause squid
> to compute the same hash value some thousand times.
>
> If we decide to not cache the hash value and there is not any objection
> from others developers I will do the followings:
> - remove the FileNaneHashCached and the FileNameHashCached class.
> - make FilenameHash a private method of the TextException class.
> - Compute the hash only in TextException::id() method. This will compute
> the hash value only if it is requested, not for all Must()
>
>>
>> * NP: if performance is _that_ much of a problem we had best look into
>> pre-calculating FileNameHash() results as a const parameter to the
>> Must/TextcHere macros during build.
> I can not find any simple way for this one. Any hint? But if we decide
> to not cache the hash value of the file name we do not need it.
A separate script that runs and does the filename hashing. It might be
run by configure, top level Makefile, or if it was useful enough we
could add it to source-maitenance.sh for permanent embedding.
Easiest would be for it to add/update a "#define FILENAMEHASH abf0" at
the top of each file which is used by the Must() macro later on.
If the hash bits were split 16/16 then the hash need only be two bytes
and easily identified by us humans as the first two of the EXCEPTION id.
The __LINE__ bit would still need to be masked on later to avoid
problems with patchings.
Amos
-- Please be using Current Stable Squid 2.7.STABLE9 or 3.1.8 Beta testers wanted for 3.2.0.2Received on Thu Oct 14 2010 - 09:46:38 MDT
This archive was generated by hypermail 2.2.0 : Thu Oct 14 2010 - 12:00:04 MDT