Return-Path: X-Original-To: apmail-flex-dev-archive@www.apache.org Delivered-To: apmail-flex-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 83C3A10120 for ; Fri, 18 Oct 2013 23:51:11 +0000 (UTC) Received: (qmail 32127 invoked by uid 500); 18 Oct 2013 23:51:10 -0000 Delivered-To: apmail-flex-dev-archive@flex.apache.org Received: (qmail 32092 invoked by uid 500); 18 Oct 2013 23:51:10 -0000 Mailing-List: contact dev-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list dev@flex.apache.org Received: (qmail 32084 invoked by uid 99); 18 Oct 2013 23:51:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Oct 2013 23:51:10 +0000 X-ASF-Spam-Status: No, hits=2.5 required=5.0 tests=FRT_ADOBE2,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of kesslerconsulting@gmail.com designates 209.85.212.175 as permitted sender) Received: from [209.85.212.175] (HELO mail-wi0-f175.google.com) (209.85.212.175) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Oct 2013 23:51:06 +0000 Received: by mail-wi0-f175.google.com with SMTP id hm4so1731548wib.2 for ; Fri, 18 Oct 2013 16:50:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=2ZXf/+VWvxYM5J3FGFoi114a2ZwRhDSc97+P3i64wn8=; b=p9QHmJjwO3vw7+EriNNFrWUMgfNI2jIxO3vnJlWGEu3/0Wfi8+B4hSALXapfe49Vcc FP8wqXRrRphclnwcx3exGiLYf9dRQfJ9X57AAyV3hthWIQP897K4DWe83ucCHZgIc4bo ZTPoLvrR8lK5tl5b+7AejO7tFmKiZUt0KhjXes+CUJ4iZZvZeflbFvkqVDyJl8yDFFad Emggr9AYEnGZnj1Lkvj1lRqvwPKOcXLMJJShEDT1oxhnecNyTKv4Wu3HwzZ7qfyMRrcA AEIMEBG2ybEi1plW9r+wRxvLlhDvijxlBCXbgpfU45eJxVf2SGQ5c9WQOCKde0AhbJ8p O1gg== MIME-Version: 1.0 X-Received: by 10.180.219.33 with SMTP id pl1mr1261963wic.49.1382140245615; Fri, 18 Oct 2013 16:50:45 -0700 (PDT) Received: by 10.194.201.1 with HTTP; Fri, 18 Oct 2013 16:50:45 -0700 (PDT) In-Reply-To: <2095F5EBE04D59409DFCE91FFCEBF7AF3F538620@EXMBX05.netplexity.local> References: <2095F5EBE04D59409DFCE91FFCEBF7AF3F53858C@EXMBX05.netplexity.local> <2095F5EBE04D59409DFCE91FFCEBF7AF3F5385BD@EXMBX05.netplexity.local> <2095F5EBE04D59409DFCE91FFCEBF7AF3F5385D6@EXMBX05.netplexity.local> <2095F5EBE04D59409DFCE91FFCEBF7AF3F538620@EXMBX05.netplexity.local> Date: Fri, 18 Oct 2013 19:50:45 -0400 Message-ID: Subject: Re: UID performance From: Mark Kessler To: "Dev@Flex" Content-Type: multipart/alternative; boundary=001a1134c9285eaaff04e90c9a1f X-Virus-Checked: Checked by ClamAV on apache.org --001a1134c9285eaaff04e90c9a1f Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I ran the swf file from your link and I got these... On Fri, Oct 18, 2013 at 7:45 PM, Maurice Amsellem < maurice.amsellem@systar.com> wrote: > I have posted FB project with the source s + compiled SWF. > > https://dl.dropboxusercontent.com/u/12169005/ApacheFlex/TestUIDPerf.fxp > https://dl.dropboxusercontent.com/u/12169005/ApacheFlex/TestUIDPerf.swf > > Algorithm 1=3D Original > Algorithm 2 =3D using Array.join() and other optimizations by JMcLean > Algo 3: using single static byteArray (Maurice) > > These are the results I get for 100,000 iterations: > > Original: 2.74s > V2: 2.5s > V3: 1.70s > > Please can you test on your side as well... > > Maurice > > -----Message d'origine----- > De : Maurice Amsellem [mailto:maurice.amsellem@systar.com] > Envoy=E9 : samedi 19 octobre 2013 00:56 > =C0 : dev@flex.apache.org > Objet : RE: UID performance > > I have used a static ByteArray as suggested: much better. > Thanks for the suggestion. > > > -----Message d'origine----- > De : Maurice Amsellem [mailto:maurice.amsellem@systar.com] > Envoy=E9 : samedi 19 octobre 2013 00:49 > =C0 : dev@flex.apache.org > Objet : RE: UID performance > > Sure, I will do that. > > I will also post the source so that you can recompile at your convenienc= e. > > Maurice > > > -----Message d'origine----- > De : Alex Harui [mailto:aharui@adobe.com] Envoy=E9 : samedi 19 octobre 20= 13 > 00:13 =C0 : dev@flex.apache.org Objet : Re: UID performance > > I'm a bit surprised that ByteArray.writeByte is faster but maybe > Array.join isn't that fast. I would also like to see a test of a single > static bytearray and resetting it and/or overwriting the old bytes. > > Maybe if you put a SWF with various algorithms in your people.a.o folder > folks can hit it and make sure we all get the same results and then we'll > know which algorithm to check in. > > Thanks for this idea as well. > > -Alex > > On 10/18/13 3:05 PM, "Maurice Amsellem" > wrote: > > >Any answer ? > > > >-----Message d'origine----- > >De : Maurice Amsellem [mailto:maurice.amsellem@systar.com] > >Envoy=E9 : vendredi 18 octobre 2013 14:39 =C0 : dev@flex.apache.org Obje= t : > >RE: UID performance > > > >Hi, > > > >I shouldn't have mixed the two options, because it's confusing. > > > >Actually, V3 option generates uppercase, exactly as the current UUID, > >and it's 2x faster. > >So let's forget about V4... > > > >Here is the code: > > > > private static const HEX_CHARS:String =3D "0123456789ABCDEF"; > > private static const DASH:int =3D 45; // "-" > > > >public static function createUID():String > > { > > var ba:ByteArray =3D new ByteArray(); > > var i:int; > > var j:int; > > > > for (i =3D 0; i < 8; i++) { > > ba.writeByte(HEX_CHARS.charCodeAt(Math.random() * 16)); > > } > > > > for (i =3D 0; i < 3; i++) > > { > > ba.writeByte(DASH); > > for (j =3D 0; j < 4; j++) > > { > > ba.writeByte(HEX_CHARS.charCodeAt(Math.random() * 16)); > > } > > } > > > > ba.writeByte(DASH); > > > > var time:Number =3D new Date().getTime(); > > > > var timeString:String =3D ("0000000" + > >time.toString(16).toUpperCase()).substr(-8); > > ba.writeUTFBytes(timeString); > > > > for (i =3D 0; i < 4; i++) > > { > > ba.writeByte(HEX_CHARS.charCodeAt(Math.random() * 16)); > > } > > > > return ba.toString(); > > } > > > >-----Message d'origine----- > >De : Justin Mclean [mailto:justin@classsoftware.com] Envoy=E9 : vendredi > >18 octobre 2013 14:34 =C0 : dev@flex.apache.org Objet : Re: UID > >performance > > > >Hi, > > > >> V3: generates the random hex bytes one by one, and writes them to the > >> BA > >> V4: generates 4 or 8 random bytes in one shot, and writes them to the > >> BA (hexa in lowercase, to avoid call toUppercase() ) > >Probably best not too fiddle too much with the UID construction. While > >I can't think of any major issues it would cause there could be subtle > >issues due to seeding of random numbers and the like. > > > >> I don't know if this is acceptable (are we breaking some code if we > >>use lowercase instead of uppercase). > > > >Again can't think of any issues but probably safer if we kept it upper > >case. > > > >Go ahead and post the code it could be interesting/useful to someone. > > > >Thanks, > >Justin > > --001a1134c9285eaaff04e90c9a1f--