[Gluster-devel] Query regarding dictionary logic
Amar Tumballi Suryanarayan
atumball at redhat.com
Tue Apr 30 08:52:42 UTC 2019
Shreyas/Kevin tried to address it some time back using
https://bugzilla.redhat.com/show_bug.cgi?id=1428049 (
https://review.gluster.org/16830)
I vaguely remember the reason to keep the hash value 1 was done during the
time when we had dictionary itself sent as on wire protocol, and in most
other places, number of entries in dictionary was on an avg, 3. So, we
felt, saving on a bit of memory for optimization was better at that time.
-Amar
On Tue, Apr 30, 2019 at 12:02 PM Mohit Agrawal <moagrawa at redhat.com> wrote:
> sure Vijay, I will try and update.
>
> Regards,
> Mohit Agrawal
>
> On Tue, Apr 30, 2019 at 11:44 AM Vijay Bellur <vbellur at redhat.com> wrote:
>
>> Hi Mohit,
>>
>> On Mon, Apr 29, 2019 at 7:15 AM Mohit Agrawal <moagrawa at redhat.com>
>> wrote:
>>
>>> Hi All,
>>>
>>> I was just looking at the code of dict, I have one query current
>>> dictionary logic.
>>> I am not able to understand why we use hash_size is 1 for a
>>> dictionary.IMO with the
>>> hash_size of 1 dictionary always work like a list, not a hash, for
>>> every lookup
>>> in dictionary complexity is O(n).
>>>
>>> Before optimizing the code I just want to know what was the exact
>>> reason to define
>>> hash_size is 1?
>>>
>>
>> This is a good question. I looked up the source in gluster's historic
>> repo [1] and hash_size is 1 even there. So, this could have been the case
>> since the first version of the dictionary code.
>>
>> Would you be able to run some tests with a larger hash_size and share
>> your observations?
>>
>> Thanks,
>> Vijay
>>
>> [1]
>> https://github.com/gluster/historic/blob/master/libglusterfs/src/dict.c
>>
>>
>>
>>>
>>> Please share your view on the same.
>>>
>>> Thanks,
>>> Mohit Agrawal
>>> _______________________________________________
>>> Gluster-devel mailing list
>>> Gluster-devel at gluster.org
>>> https://lists.gluster.org/mailman/listinfo/gluster-devel
>>
>> _______________________________________________
> Gluster-devel mailing list
> Gluster-devel at gluster.org
> https://lists.gluster.org/mailman/listinfo/gluster-devel
--
Amar Tumballi (amarts)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gluster.org/pipermail/gluster-devel/attachments/20190430/5e87800f/attachment.html>
More information about the Gluster-devel
mailing list