From 02f7b90a67b15f6044a0d28d5dae1903c613b109 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 31 Jan 2002 01:04:54 +0000 Subject: [PATCH] Avoid some extra array allocation and fiddling if we've got zero or one items in our dirty item list. No need for sorting and copying in such cases. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@899 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/java/com/threerings/miso/client/DirtyItemList.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/miso/client/DirtyItemList.java b/src/java/com/threerings/miso/client/DirtyItemList.java index 23b1c47a5..abc8bb6dd 100644 --- a/src/java/com/threerings/miso/client/DirtyItemList.java +++ b/src/java/com/threerings/miso/client/DirtyItemList.java @@ -1,5 +1,5 @@ // -// $Id: DirtyItemList.java,v 1.8 2001/12/16 06:10:33 shaper Exp $ +// $Id: DirtyItemList.java,v 1.9 2002/01/31 01:04:54 mdb Exp $ package com.threerings.miso.scene; @@ -68,6 +68,10 @@ public class DirtyItemList // get items sorted by increasing origin x-coordinate DirtyItem[] xitems = new DirtyItem[size]; _items.toArray(xitems); + // if we've only got one item, bail out now + if (xitems.length < 2) { + return xitems; + } Arrays.sort(xitems, ORIGIN_X_COMP); if (DEBUG_SORT) {