Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: remove unnecessary extra child traversal in collectDirtyChildren #1058

Merged
5 changes: 3 additions & 2 deletions parse/src/main/java/com/parse/ParseObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,9 @@ protected boolean visit(Object node) {
// Check for cycles of new objects. Any such cycle means it will be
// impossible to save this collection of objects, so throw an exception.
if (object.getObjectId() != null) {
seenNew = new HashSet<>();
if (!seenNew.isEmpty()) {
seenNew = new HashSet<>();
}
} else {
if (seenNew.contains(object)) {
throw new RuntimeException("Found a circular dependency while saving.");
Expand All @@ -605,7 +607,6 @@ protected boolean visit(Object node) {
if (seen.contains(object)) {
return true;
}
seen = new HashSet<>(seen);
seen.add(object);

// Recurse into this object's children looking for dirty children.
Expand Down