dt = New Table( "dummy table" );
NR = 10E6;
dt << add rows( NR );
dt << New Column( "random", set each value( Random Uniform( 0, 100 ) ) );
For Each( {percent, idx},
{0.00001, 0.00002, 0.00005, 0.0001, 0.0002, 0.0005, 0.001, 0.002, 0.005, 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 15, 20, 30, 40, 50, 60,
70, 80, 90, 100},
Print( percent );
dt << Clear Row States;
dt << select where( :random < percent );
dt << Hide and Exclude;
nexcl = N Rows( dt << Get Excluded Rows );
dt << Clear Select;
Wait();
// Jim
bt = HP Time();
allRows = dt << get rows where( Excluded( Row State( Row() ) ) == 0 );
et = HP Time();
time1 = et - bt;
// Jim X
bt = HP Time();
allRows = dt << get rows where( Excluded() == 0 );
et = HP Time();
time2 = et - bt;
// Jarmo
bt = HP Time();
excl_rows = dt << Get Excluded Rows;
et = HP Time();
time3a = et - bt;
all_rows = 1 :: N Rows( dt );
all_rows[excl_rows] = .;
all_rows = Loc(all_rows);
et = HP Time();
time3 = et - bt;
// hogi
If( idx < 11,
bt = HP Time();
excl = dt << Get Excluded Rows;
allRows = (1 :: N Rows( dt ));
For Each( {i, j}, Reverse( excl ), Remove From( allRows, i, 1 ) );
et = HP Time();
time4 = et - bt;
);
Wait();
If( idx == 1,
New Window( "timing results",
tb = Table Box(
Number Col Box( "# excluded", {Nexcl} ),
Number Col Box( "Jim", {time1 / 1000000} ),
Number Col Box( "Jim X", {time2 / 1000000} ),
Number Col Box( "Jarmo", {time3 / 1000000} ),
Number Col Box( "Jarmo (get ... rows)", {time3a / 1000000} ),
Number Col Box( "hogi", {time4 / 1000000} ),
)
)
,
If( idx < 11,
tb << add row( {Nexcl, time1 / 1000000, time2 / 1000000, time3 / 1000000,time3a / 1000000, time4 / 1000000} ),
tb << add row( {Nexcl, time1 / 1000000, time2 / 1000000, time3 / 1000000, time3a / 1000000} )
)
);
);
results = tb << Make Combined Data Table;
gb = results << Graph Builder(
Show Control Panel( 0 ),
Variables( X( :"# excluded"n ), Y( :Jim ), Y( :Jim X, Position( 1 ) ), Y( :Jarmo, Position( 1 ) ), Y( :hogi, Position( 1 ) ) ),
Elements( Points( X, Y( 1 ), Y( 2 ), Y( 3 ), Y( 4 ), Legend( 5 ) ), Smoother( X, Y( 1 ), Y( 2 ), Y( 3 ), Y( 4 ), Legend( 6 ), Lambda( 0.001 ) ) )
);
Report( gb )[AxisBox( 1 )] << {Scale( "Log" ), Min( 1 ), Max( 10000000 )};
Report( gb )[AxisBox( 2 )] << {Scale( "Log" ), Min( 0.1 ), Max( 10 ),Label Row( Show Minor Grid( 1 ) )};
Report( gb )[Text Edit Box( 4 )] << Set Text( "time [s]" )
dt = New Table( "dummy table" );
NR = 10E6;
dt << add rows( NR );
dt << New Column( "random", set each value( Random Uniform( 0, 100 ) ) );
For Each( {percent, idx},
{0.00001, 0.00002, 0.00005, 0.0001, 0.0002, 0.0005, 0.001, 0.002, 0.005, 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 15, 20, 30, 40, 50, 60,
70, 80, 90, 100},
Print( percent );
dt << Clear Row States;
dt << select where( :random < percent );
dt << Hide and Exclude;
nexcl = N Rows( dt << Get Excluded Rows );
dt << Clear Select;
Wait();
// Jim
bt = HP Time();
allRows = dt << get rows where( Excluded( Row State( Row() ) ) == 0 );
et = HP Time();
time1 = et - bt;
// Jim X
bt = HP Time();
allRows = dt << get rows where( Excluded() == 0 );
et = HP Time();
time2 = et - bt;
// Jarmo
bt = HP Time();
excl_rows = dt << Get Excluded Rows;
et = HP Time();
time3a = et - bt;
all_rows = 1 :: N Rows( dt );
all_rows[excl_rows] = .;
all_rows = Loc(all_rows);
et = HP Time();
time3 = et - bt;
// hogi
If( idx < 11,
bt = HP Time();
excl = dt << Get Excluded Rows;
allRows = (1 :: N Rows( dt ));
For Each( {i, j}, Reverse( excl ), Remove From( allRows, i, 1 ) );
et = HP Time();
time4 = et - bt;
);
Wait();
If( idx == 1,
New Window( "timing results",
tb = Table Box(
Number Col Box( "# excluded", {Nexcl} ),
Number Col Box( "Jim", {time1 / 1000000} ),
Number Col Box( "Jim X", {time2 / 1000000} ),
Number Col Box( "Jarmo", {time3 / 1000000} ),
Number Col Box( "Jarmo (get ... rows)", {time3a / 1000000} ),
Number Col Box( "hogi", {time4 / 1000000} ),
)
)
,
If( idx < 11,
tb << add row( {Nexcl, time1 / 1000000, time2 / 1000000, time3 / 1000000,time3a / 1000000, time4 / 1000000} ),
tb << add row( {Nexcl, time1 / 1000000, time2 / 1000000, time3 / 1000000, time3a / 1000000} )
)
);
);
results = tb << Make Combined Data Table;
gb = results << Graph Builder(
Show Control Panel( 0 ),
Variables( X( :"# excluded"n ), Y( :Jim ), Y( :Jim X, Position( 1 ) ), Y( :Jarmo, Position( 1 ) ), Y( :hogi, Position( 1 ) ) ),
Elements( Points( X, Y( 1 ), Y( 2 ), Y( 3 ), Y( 4 ), Legend( 5 ) ), Smoother( X, Y( 1 ), Y( 2 ), Y( 3 ), Y( 4 ), Legend( 6 ), Lambda( 0.001 ) ) )
);
Report( gb )[AxisBox( 1 )] << {Scale( "Log" ), Min( 1 ), Max( 10000000 )};
Report( gb )[AxisBox( 2 )] << {Scale( "Log" ), Min( 0.1 ), Max( 10 ),Label Row( Show Minor Grid( 1 ) )};
Report( gb )[Text Edit Box( 4 )] << Set Text( "time [s]" )