+1 Also need to check these classes with lots of static utility methods: IgniteUtils and X.
On Fri, Apr 1, 2016 at 11:03 AM, Vladimir Ozerov <voze...@gridgain.com> wrote: > Igniters, > > This is about our infamous *GridFunc *class. I suggest to deprecate it and > strongly discourage any usage of any method from it. > > *Motivation:* > Currently this class contains ~170 methods. Lots of this methods have poor > performance characteristics or broken semantics. > - Lots of collection manipulation methods are broken. You can easily loose > O(1) or O(log N) and have O(N). You can easily loose Set semantics - merge > two sets and this is not a set anymore. Etc, etc.. This is a nightmare. + > you allocate garbage. > - Some methods operate on varags while we always need no more than one > element -> unnecessary allocations. > > But as these methods are convenient to use, developers tend to use them > without understanding of implications. As our product is > performance-sensitive, we certainly should avoid this. > > For example, here is a code snippet from cache IO manager: > > if (!F.exist(F.nodeIds(nodes), F0.not(F.contains(leftIds)))) { > > ... > > } > > > And how do you think, what is "nodes" variable? Here it is: > > F.view(F.viewReadOnly(ids, U.id2Node(ctx), p), F.notNull()) > > > WTF? We *MUST* stop that. > > *Proposal:* > 1) Deprecate this class. > 2) Move several useful and safe methods (like F.eq()) to separate > specialized utility classes. > > Thoughts? > > Vladimir. >