From: David ‘Bombe’ Roden Date: Fri, 21 Jan 2011 11:16:36 +0000 (+0100) Subject: Small performance improvements. X-Git-Tag: 0.4.2^2~8 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=9caabd21dd058a0ca1a577c1ed9c58d72a86e193;p=Sone.git Small performance improvements. --- diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index c8d500e..00e7deb 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -1047,10 +1047,11 @@ public class Core implements IdentityListener, UpdateListener { } } } + List storedPosts = storedSone.getPosts(); synchronized (newPosts) { for (Post post : sone.getPosts()) { - post.setSone(getSone(post.getSone().getId())); - if (!storedSone.getPosts().contains(post) && !knownPosts.contains(post.getId())) { + post.setSone(storedSone); + if (!storedPosts.contains(post) && !knownPosts.contains(post.getId())) { newPosts.add(post.getId()); coreListenerManager.fireNewPostFound(post); } @@ -1067,10 +1068,11 @@ public class Core implements IdentityListener, UpdateListener { } } } + Set storedReplies = sone.getReplies(); synchronized (newReplies) { for (Reply reply : sone.getReplies()) { - reply.setSone(getSone(reply.getSone().getId())); - if (!storedSone.getReplies().contains(reply) && !knownReplies.contains(reply.getId())) { + reply.setSone(storedSone); + if (!storedReplies.contains(reply) && !knownReplies.contains(reply.getId())) { newReplies.add(reply.getId()); coreListenerManager.fireNewReplyFound(reply); }