Hello,

I'm wondering the difference between the overhead of using homogeneous
tuple and array, for example:
var TupleVar: 8*real;
var ArrayVar: [1..8] real;

1. Are they both allocated on memory in a row-major behavior ? (Index order
makes big difference ?)

2. I played a little bit on both with a toy program:
    var stt = getCurrentTime();
    for i in 1..8 {
        for j in 1..12345678 {
            tmp = j/101 + 3.14/j;
            tupleVar[i] += tmp;
        }
    }
    var ent = getCurrentTime();
    writeln("Total Time of tuple: ", ent-stt);

    stt = getCurrentTime();
    for i in 1..8 {
        for j in 1..12345678 {
            tmp = j/101 + 3.14/j;
            arrayVar[i] += tmp;
        }
    }
    ent = getCurrentTime();
    writeln("Total Time of array: ", ent-stt);

 The time for tuple is about 2.25 seconds, while the time for array is
about 4.8 seconds, more than twice of the one tuple one, kinda superised
me, I want to know why.

Thank you !

-- 
Best regards


Hui Zhang
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to