Thanks for your reply. >-----Original Message----- >From: Michel Machado [mailto:mic...@digirati.com.br]
> Exposing the private fields would bind the interface with the >current implementation of the hash table. In the way we are proposing, >one should be able to replace the underlying algorithm and not touching >the header files that applications use. But, yes, your solution would >enable applications to allocate iterator states as local variables as well. > [Wang, Yipeng] I didn't mean to expose the private fields. But only the Type. For example, rte_hash does not expose its private fields to users. One can change the fields without changing API. > > Notice that the field total_entry only exists for >rte_hash_iterate(). But even if total_entry were in the state of >rte_hash_iterate_conflict_entries(), it would still save on the >multiplication as long as rte_hash_iterate_conflict_entries() is called >at least twice. Calling rte_hash_iterate_conflict_entries() once evens >out, and calling rte_hash_iterate_conflict_entries() more times adds >further savings. As a side note. in our application, whenever an >iterator of conflicting entries is initialized, we call >rte_hash_iterate_conflict_entries() at least once. > [Wang, Yipeng] I mean the extra overhead of _init function which does the Calculation. For iterate_conflict_entries, since it does not need Total_entries, _init will cost extra cycles for the calculation, especially in my imaginary use cases, one may call _init multiple times on the same state to iterate different keys. I guess your application is not sensitive to this overhead, So I think I am OK with current implementation. > >[ ]'s >Michel Machado