From commits-return-4349-apmail-pig-commits-archive=pig.apache.org@pig.apache.org Thu Jul 14 15:12:59 2011 Return-Path: X-Original-To: apmail-pig-commits-archive@www.apache.org Delivered-To: apmail-pig-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1B7357AC4 for ; Thu, 14 Jul 2011 15:12:59 +0000 (UTC) Received: (qmail 12726 invoked by uid 500); 14 Jul 2011 15:12:59 -0000 Delivered-To: apmail-pig-commits-archive@pig.apache.org Received: (qmail 12705 invoked by uid 500); 14 Jul 2011 15:12:57 -0000 Mailing-List: contact commits-help@pig.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pig.apache.org Delivered-To: mailing list commits@pig.apache.org Received: (qmail 12698 invoked by uid 99); 14 Jul 2011 15:12:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jul 2011 15:12:57 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jul 2011 15:12:54 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id EE9E123888EA for ; Thu, 14 Jul 2011 15:12:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1146746 - in /pig/trunk: CHANGES.txt src/org/apache/pig/data/DefaultTuple.java Date: Thu, 14 Jul 2011 15:12:33 -0000 To: commits@pig.apache.org From: thejas@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110714151233.EE9E123888EA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: thejas Date: Thu Jul 14 15:12:33 2011 New Revision: 1146746 URL: http://svn.apache.org/viewvc?rev=1146746&view=rev Log: PIG-2001: DefaultTuple(List) constructor is inefficient, causes List.size() System.arraycopy() calls (though they are 0 byte copies), DefaultTuple(int) constructor is a bit misleading wrt time complexity (woody via thejas) Modified: pig/trunk/CHANGES.txt pig/trunk/src/org/apache/pig/data/DefaultTuple.java Modified: pig/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1146746&r1=1146745&r2=1146746&view=diff ============================================================================== --- pig/trunk/CHANGES.txt (original) +++ pig/trunk/CHANGES.txt Thu Jul 14 15:12:33 2011 @@ -24,6 +24,11 @@ INCOMPATIBLE CHANGES IMPROVEMENTS +PIG-2001: DefaultTuple(List) constructor is inefficient, causes List.size() + System.arraycopy() calls (though they are 0 byte copies), + DefaultTuple(int) constructor is a bit misleading wrt time + complexity (woody via thejas) + PIG-1916: Nested cross (zjshen via daijy) PIG-2128: Generating the jar file takes a lot of time and is unnecessary when running Pig local mode (julien) Modified: pig/trunk/src/org/apache/pig/data/DefaultTuple.java URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/data/DefaultTuple.java?rev=1146746&r1=1146745&r2=1146746&view=diff ============================================================================== --- pig/trunk/src/org/apache/pig/data/DefaultTuple.java (original) +++ pig/trunk/src/org/apache/pig/data/DefaultTuple.java Thu Jul 14 15:12:33 2011 @@ -54,6 +54,7 @@ public class DefaultTuple implements Tup /** * Default constructor. This constructor is public so that hadoop can call it directly. However, inside pig you * should never be calling this function. Use TupleFactory instead. + *
Time complexity: O(1), after allocation */ public DefaultTuple() { mFields = new ArrayList(); @@ -61,6 +62,7 @@ public class DefaultTuple implements Tup /** * Construct a tuple with a known number of fields. Package level so that callers cannot directly invoke it. + *
Resulting tuple is filled pre-filled with null elements. Time complexity: O(N), after allocation * * @param size * Number of fields to allocate in the tuple. @@ -73,21 +75,17 @@ public class DefaultTuple implements Tup /** * Construct a tuple from an existing list of objects. Package level so that callers cannot directly invoke it. - * + *
Time complexity: O(N) plus running time of input object iteration, after allocation * @param c * List of objects to turn into a tuple. */ DefaultTuple(List c) { - mFields = new ArrayList(c.size()); - - Iterator i = c.iterator(); - int field; - for (field = 0; i.hasNext(); field++) - mFields.add(field, i.next()); + mFields = new ArrayList(c); } /** * Construct a tuple from an existing list of objects. Package level so that callers cannot directly invoke it. + *
Time complexity: O(1) * * @param c * List of objects to turn into a tuple. This list will be kept as part of the tuple.