> On June 3, 2016, 11:25 p.m., Suma Shivaprasad wrote: > > repository/src/main/java/org/apache/atlas/repository/graph/TypedInstanceToGraphMapper.java, > > line 785 > > <https://reviews.apache.org/r/47658/diff/5/?file=1405688#file1405688line785> > > > > do we need the HashSet since contains and all will both O(n) > > David Kantor wrote: > HashSet.contains is O(1). I am using the HashSet to avoid the O(n) > performance of ArrayList.contains. For a very small data set, the difference > between HashSet.contains and ArrayList.contains is probably negligible. But > in my experience doing Java performance analysis on our legacy metadata > repository, ArrayList.contains() often ended up being a major hot spot when > enforcing uniqueness for high cardinality references. > > Suma Shivaprasad wrote: > I was just saying that adding all the list elemnts to the Hashset is > itself O(n) so it might be better to skip creating the hashset. Leave it up > to you not a major issue to fix.
Thanks very much for clarifying that, I agree and have addressed the comment. - David ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/47658/#review136132 ----------------------------------------------------------- On June 6, 2016, 10:53 p.m., David Kantor wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/47658/ > ----------------------------------------------------------- > > (Updated June 6, 2016, 10:53 p.m.) > > > Review request for atlas and Shwetha GS. > > > Bugs: ATLAS-499 > https://issues.apache.org/jira/browse/ATLAS-499 > > > Repository: atlas > > > Description > ------- > > ATLAS-499: Automatically update inverse references to prevent repository > corruption from unbalanced references. > > > Diffs > ----- > > > repository/src/main/java/org/apache/atlas/repository/graph/DeleteHandler.java > 91f9bd008a6939dfe78656f5c1845637a30ee9eb > repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java > 4f6d0118072380342f5ea302d0aaf7902784849a > > repository/src/main/java/org/apache/atlas/repository/graph/TypedInstanceToGraphMapper.java > 4c1f5591f4adead41c3336e64b0bc956836f7edb > > repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepositoryDeleteTestBase.java > 449e066a167ba4546b118a77c8e3de5fd99f077b > > repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateHardDeleteTest.java > PRE-CREATION > > repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateSoftDeleteTest.java > PRE-CREATION > > repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateTestBase.java > PRE-CREATION > > Diff: https://reviews.apache.org/r/47658/diff/ > > > Testing > ------- > > Ran all unit and integration tests with no regressions. > > > Thanks, > > David Kantor > >
