Hello Anh, A small idea to improve array allocation is to use "new Array[T](n)" (or for consistency "new Rail[T](n)") instead of "new Array[T](0..(n-1))". Array has a special constructor for allocating rail which takes Int as length. With this ctor, you don't need to allocate IntRange object which is itself an overhead in allocation intensive programs such as yours.
Mikio Takeuchi IBM Research - Tokro 2011/11/3 Anh Trinh <a...@pacbell.net>: > Hi, > Changed Array[Byte] to Rail[Byte], I can see performance boost, but Java is > still 2x faster > File: 21M > X10: 25 seconds > Java: 17 seconds > There are places I do this: > val tmp:Rail[Rail[Byte]]= new > Array[Array[Byte](1){rect,zeroBased,rail}](0..(Nb*(Nr+1)-1)); > for(var i:int=0; i<tmp.size; i++){ > tmp(i) = new Array[Byte](0..3); > } > > > wonder if this will hit performance, I tried Array constructor > new Array[Rail[Byte]](0..(Nb*(Nr+1)-1), i:Point(1)=>new > Array[Byte](0..3)); > and other variations, but not successful. Any suggestion for more > performance? > > Thanks > > > > > On Nov 2, 2011, at 6:34 PM, David P Grove wrote: > > Anh <a...@pacbell.net> wrote on 11/02/2011 09:12:52 PM: >> >> looking at library API, I don't see Rail. Does latest version have >> this feature? I saw this from previous version > > Yes. It's now a typedef for Array[T]{rank==1,zeroBased,rect}. In older > versions of X10 it was a special, hand-optimized class distinct from Array. > > The tool that generates the library documentation is based on javadoc and > doesn't quite understand X10's typedefs. If you look in x10.lang.Rail.x10 > you'll find it: > > [dgrove@wahtutca lang]$ more Rail.x10 > /* > * This file is part of the X10 project (http://x10-lang.org). > * > * This file is licensed to You under the Eclipse Public License (EPL); > * You may not use this file except in compliance with the License. > * You may obtain a copy of the License at > * http://www.opensource.org/licenses/eclipse-1.0.php > * > * (C) Copyright IBM Corporation 2006-2010. > */ > > package x10.lang; > > public type Rail[T] = > Array[T]{self.rank==1,self.zeroBased,self.rect,self.rail}; > > --dave > > > ------------------------------------------------------------------------------ > RSA(R) Conference 2012 > Save $700 by Nov 18 > Register now > http://p.sf.net/sfu/rsa-sfdev2dev1 > _______________________________________________ > X10-users mailing list > X10-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/x10-users > > ------------------------------------------------------------------------------ RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users