Names Default To Here( 1 );
dt = New Table( "test",
add rows( 1000000 ),
New Column( "rw1", Character, set each value( "row " || Char( Row() ) ) ),
New Column( "rw2", Character, set each value( "row " || Char( Row() ) ) ),
New Column( "rw3", Character, set each value( "row " || Char( Row() ) ) ),
New Column( "rw4", Character, set each value( "row " || Char( Row() ) ) ),
New Column( "rw5" ),
New Column( "rw6" )
);
t0 = HP Time();
dt << Begin Data Update;
dt << Recode Column( dt:rw1, {Substitute( _rcNow, "row", "" ), Num( _rcNow )}, Update Properties( 1 ), Target Column( :rw1 ) );
dt << End Data Update;
time = (HP Time() - t0) / 1000000;
Print( "recode and change to numeric" );
Show( time );
t0 = HP Time();
dt << Begin Data Update;
dt << Recode Column( dt:rw2, {Substitute( _rcNow, "row", "" )}, Update Properties( 1 ), Target Column( :rw2 ) );
dt << End Data Update;
dt:rw2 << Set Data Type( Numeric );
time = (HP Time() - t0) / 1000000;
Print( "recode" );
Show( time );
t0 = HP Time();
dt << Begin Data Update;
For Each Row( dt, dt:rw3[] = Substitute( dt:rw3, "row", "" ) );
dt << End Data Update;
dt:rw3 << Set Data Type( Numeric );
time = (HP Time() - t0) / 1000000;
Print( "For each row" );
Show( time );
t0 = HP Time();
dt << Begin Data Update;
dt << Recode Column( rw4, {Substitute( _rcNow, "row", "" ), Num( _rcNow )}, Update Properties( 1 ), Target Column( :rw5 ) );
dt << End Data Update;
time = (HP Time() - t0) / 1000000;
Print( "recode and change to numeric - new column" );
Show( time );
t0 = HP Time();
dt << Begin Data Update;
dt << Recode Column( rw6, {Num( _rcNow )}, Update Properties( 1 ), Target Column( :rw6 ) );
dt << End Data Update;
time = (HP Time() - t0) / 1000000;
Print( "just: change to numeric" );
Show( time );
Names Default To Here( 1 );
dt = New Table( "test",
add rows( 1000000 ),
New Column( "rw1", Character, set each value( "row " || Char( Row() ) ) ),
New Column( "rw2", Character, set each value( "row " || Char( Row() ) ) ),
New Column( "rw3", Character, set each value( "row " || Char( Row() ) ) ),
New Column( "rw4", Character, set each value( "row " || Char( Row() ) ) ),
New Column( "rw5" ),
New Column( "rw6" )
);
t0 = HP Time();
dt << Begin Data Update;
dt << Recode Column( dt:rw1, {Substitute( _rcNow, "row", "" ), Num( _rcNow )}, Update Properties( 1 ), Target Column( :rw1 ) );
dt << End Data Update;
time = (HP Time() - t0) / 1000000;
Print( "recode and change to numeric" );
Show( time );
t0 = HP Time();
dt << Begin Data Update;
dt << Recode Column( dt:rw2, {Substitute( _rcNow, "row", "" )}, Update Properties( 1 ), Target Column( :rw2 ) );
dt << End Data Update;
dt:rw2 << Set Data Type( Numeric );
time = (HP Time() - t0) / 1000000;
Print( "recode" );
Show( time );
t0 = HP Time();
dt << Begin Data Update;
For Each Row( dt, dt:rw3[] = Substitute( dt:rw3, "row", "" ) );
dt << End Data Update;
dt:rw3 << Set Data Type( Numeric );
time = (HP Time() - t0) / 1000000;
Print( "For each row" );
Show( time );
t0 = HP Time();
dt << Begin Data Update;
dt << Recode Column( rw4, {Substitute( _rcNow, "row", "" ), Num( _rcNow )}, Update Properties( 1 ), Target Column( :rw5 ) );
dt << End Data Update;
time = (HP Time() - t0) / 1000000;
Print( "recode and change to numeric - new column" );
Show( time );
t0 = HP Time();
dt << Begin Data Update;
dt << Recode Column( rw6, {Num( _rcNow )}, Update Properties( 1 ), Target Column( :rw6 ) );
dt << End Data Update;
time = (HP Time() - t0) / 1000000;
Print( "just: change to numeric" );
Show( time );