[
https://issues.apache.org/jira/browse/IGNITE-2263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15075382#comment-15075382
]
Vladimir Ozerov commented on IGNITE-2263:
-----------------------------------------
As I said, I performed some refactoring inside GridFunc. It allowed to remove
about of ~30% of code from this class, and gave clear picure of all view
usages. There are two big groups of "views" - transformers and filters.
1) Trasnforming views - simply converts Collection<T1> to Collection<T2>
- About 70 usages in code
- Almost always has read-only semantics.
For these views I do not see any reasons to change something. They are very
light-weight, and preserve semantics. That is, List remains List, Set remains
Set, sorted collection remains sorted, O(1) size() remains O(1), etc.
2) Filtering views - hides some elements from the list.
- About 70 usages in code
- *Not read-only*
- Has poor update semantics
- Has poor performance because size/empty/contains is always O(N)
This is where things become interesting. Sometimes these views are used without
any real need, sometimes they are mutated (sick!). I think we must carefully
review all "filtering" view usages and do the following:
1) Use Sergi's proposal if a) this is not a hot path; b) there is no need to
reflect changes to parent collection in this view;
2) Apply read-only semantics for remaining usages when applicable;
3) At this point we will have only few usages pointing to either poor code or
leaked abstractions. These places must be refactored. One such example is
GridDistributedTxMapping.
> Get rid of wrapping views where possible.
> -----------------------------------------
>
> Key: IGNITE-2263
> URL: https://issues.apache.org/jira/browse/IGNITE-2263
> Project: Ignite
> Issue Type: Sub-task
> Components: general
> Affects Versions: ignite-1.4
> Reporter: Vladimir Ozerov
> Assignee: Vladimir Ozerov
> Priority: Critical
> Fix For: 1.6
>
>
> We have about ~50-100 usages of things like F.view or F.viewReadOnly. In lots
> cases it is not necessary, adds garbage, but doesn't add any value.
> Need to revisit these places.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)