From: Denis Kenzior <denkenz@gmail.com>
To: ell@lists.01.org
Subject: Re: [PATCH 6/9] hashmap: Add re-entrancy support to foreach function
Date: Tue, 17 Feb 2015 10:41:34 -0600 [thread overview]
Message-ID: <54E36F3E.1010101@gmail.com> (raw)
In-Reply-To: <54E30E65.4030405@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 2562 bytes --]
Hi Tomasz,
>
> It's nice to get such goal clarifications, the earlier the better
> though: it was not as clear as that when we started.
Seriously? Remember, 'Embedded Linux Library'. I think the focus is
pretty clear ;)
>
> If memory is at stake, why promoting a bit of performance via storing
> the hash per-entry in the hashmap?
Because you do want to re-compute the hash, that is expensive.
Especially since the hash can be supplied by the user and could be
arbitrarily expensive computationally.
> Why also enabling the storage of the same key multiple times?
> (though that should not be an issue if the code is made without bug, but
> anyway the library should help just a bit when it's not too costly.)
ELL has been designed with existing usage in mind. We looked at what
BlueZ, oFono, ConnMan, neard, etc are doing and designed the API around
that. The goal is to make an API that would be fairly close to what
we're already doing today. This would make our future porting efforts
easier.
You will find that most of our code uses lookup then insert with no
possibility of duplicates. So as I pointed out earlier, I don't see a
need to detect duplicates at the cost of traversing the collision queue.
Simply put, if it ain't broke, don't fix it.
>
> Why also copying the key in the hashmap, when this could be wisely
> shared with the structure it points to?
> I am thinking about the network's object path. We rebuilt the object
> path dynamically, when we could be using just the same pointer.
> It would only require to be careful not to destroy a network structure,
> before removing its entry in the hash.
> (here it's a win/win on memory/performance)
Which hash are you talking about? And we have a path and an id that we
generate. You might be able to optimize one, but not the other.
Anyway, can be done and might even be a good idea. But how is this
relevant to the discussion about re-entrancy?
>
>
> On list - or queues - what are the arguments about using dynamically
> allocated ones vs the linux "list.h" way for instance?
> Isn't the later one a bit better from memory point of view if it would
> be single linked one (as it is not if I remember well)?
> (though the syntax is odd I agree, taste issue issue here so it's
> subjective).
>
We looked into that and decided against it. Yes it is a bit more
efficient storage wise if used right, but the syntax is painful. It is
also not really what we're used to (see above).
Regards,
-Denis
next prev parent reply other threads:[~2015-02-17 16:41 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-10 14:42 [PATCH 0/9] hashmap fixes Jukka Rissanen
2015-02-10 14:42 ` [PATCH 1/9] hashmap: Add value free function Jukka Rissanen
2015-02-10 14:42 ` [PATCH 2/9] hashmap: Call user supplied value free function in destroy Jukka Rissanen
2015-02-10 19:07 ` Denis Kenzior
2015-02-10 14:42 ` [PATCH 3/9] hashmap: Call user supplied value free function in insert Jukka Rissanen
2015-02-10 19:18 ` Denis Kenzior
2015-02-11 9:27 ` Patrik Flykt
2015-02-11 11:04 ` Tomasz Bursztyka
2015-02-11 13:50 ` Denis Kenzior
2015-02-10 14:42 ` [PATCH 4/9] unit: hashmap: Add value free hash entry test Jukka Rissanen
2015-02-10 14:42 ` [PATCH 5/9] unit: hashmap: Add replace " Jukka Rissanen
2015-02-10 14:42 ` [PATCH 6/9] hashmap: Add re-entrancy support to foreach function Jukka Rissanen
2015-02-10 19:47 ` Denis Kenzior
2015-02-11 9:21 ` Patrik Flykt
2015-02-11 14:06 ` Denis Kenzior
2015-02-12 7:23 ` Jukka Rissanen
2015-02-12 18:02 ` Denis Kenzior
2015-02-12 7:25 ` Jukka Rissanen
2015-02-12 17:55 ` Denis Kenzior
2015-02-13 15:38 ` Luiz Augusto von Dentz
2015-02-13 17:04 ` Denis Kenzior
2015-02-13 17:36 ` Marcel Holtmann
2015-02-16 9:44 ` Luiz Augusto von Dentz
2015-02-16 16:18 ` Marcel Holtmann
2015-02-16 18:27 ` Luiz Augusto von Dentz
2015-02-16 19:03 ` Marcel Holtmann
2015-02-17 9:48 ` Tomasz Bursztyka
2015-02-17 16:41 ` Denis Kenzior [this message]
2015-02-18 8:23 ` Tomasz Bursztyka
2015-02-10 14:42 ` [PATCH 7/9] unit: hashmap: Re-entrancy tests added Jukka Rissanen
2015-02-10 14:42 ` [PATCH 8/9] hashmap: Add support to finding an element from hash Jukka Rissanen
2015-02-12 8:35 ` Jukka Rissanen
2015-02-13 0:19 ` Denis Kenzior
2015-02-10 14:42 ` [PATCH 9/9] unit: hashmap: Add unit test for l_hashmap_find Jukka Rissanen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54E36F3E.1010101@gmail.com \
--to=denkenz@gmail.com \
--cc=ell@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.