<div dir="ltr"><div>Let me explain why it is there first :) This class was added for two main reasons: as a replacement for compatibility and for supporting equality of byte[] object. What this class does is at the user side is box the given arguments (eg. byte[] -&gt; WrappedByteArray) then the cache only ever deals with the boxed types and then does the unboxing for any values that are returned.</div><div><br></div><div>There are some exceptions with how the boxing/unboxing works for both cases such as Streams and Indexing which have to rebox the data to work properly. But the cost is pretty minimal.  <br></div><div><br></div><div><div>While compatibility is always on or off unfortunately anyone can pass in a byte[] at any point for a key or value. So we need to have these wrappers there to make sure they work properly. </div><div><br></div><div>We could add a option to the cache, which people didn&#39;t show interest before, to have a cache that doesn&#39;t support byte[] or compatibility. In this case there would be no need for the wrapper.</div></div><div><br></div><div><br></div><div>Compatibility</div><div><br></div><div>By using the wrapper around the cache, compatibility becomes quite trivial since we just need a converter in the wrapper and it does everything else for us. My guess is the new encoding changes will utilize these wrapper classes as well as they are quite easy to plug in and have things just work.</div><div><br></div><div>Equality</div><div><br></div><div>With the rewrite for eviction we lost the ability to use custom Equality in the data container. The only option for that is to wrap a byte[] to provide our own equality. Therefore the wrapper does this conversion for us by converting between automatically.</div><div><br></div><div class="gmail_quote"><div dir="ltr">On Wed, May 31, 2017 at 2:34 PM Sanne Grinovero &lt;<a href="mailto:sanne@infinispan.org">sanne@infinispan.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I&#39;ve been running some benchmarks and for the fist time playing with<br>
Infinispan 9+, so please bear with me as I might shoot some dumb<br>
questions to the list in the following days.<br>
<br>
The need for TypeConverterDelegatingAdvancedCache to wrap most<br>
operations - especially &quot;convertKeys&quot; - is highlighet as one of the<br></blockquote><div><br></div><div>It should be wrapping every operation pretty much.</div><div><br></div><div>Unfortunately the methods this hurts the most are putAll, getAll etc as they have to not only box every entry but copy them into a new collection as you saw in &quot;convertKeys&quot;. And for getAll it also has to unbox the return as well.</div><div><br></div><div>We could reduce allocations in the collection methods by not creating the new collection until we run into one key or value that required boxing/unboxing. This would still require fully iterating over the collection at best case. This should perform well in majority of cases as I would expect all or almost all entries either require or don&#39;t require the boxing. The cases that would be harmed most would be ones that have a sparse number of entries that require boxing.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
high allocators in my Search-centric use case.<br>
<br>
I&#39;m wondering:<br>
 A - Could this implementation be improved?<br></blockquote><div><br></div><div>Most anything can be improved :) The best way would be to add another knob.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 B - Could I bypass / disable it? Not sure why it&#39;s there.<br></blockquote><div><br></div><div>There is no way to bypass currently. Explained above.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks,<br>
Sanne<br>
_______________________________________________<br>
infinispan-dev mailing list<br>
<a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev<br></a><br>
</blockquote></div></div>