Hi Chaps,
Does declaring space and then only refering to slices thereof
var xcoli : [1..n] real;
for i in 1..n do
{
var R = i..m;
xcoli[R] = x[R][i];
// code which always refers to just xcoli[R]
// so as to only use the slice over i..m
}
put as much load on the run-time as the alternative which allocate space
each time through the loop, i.e. like
for i in 1..n do
{
var R = i..m;
var xcolii = x[R][i];
// code can simply refer to xcoli because
// it is by definition the slice over i..m
}
Then again, does the restricted scope of xci in the second example make it
easier for a future optimizer.
One can also argue that the restricted scope makes it easier for a reader
of a program or even a verification tool. However, instantiation of lots
of space allocations and copies will often be prohibitive.
Thanks - Damian
Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
Views & opinions here are mine and not those of any past or present employer
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers