Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <cfscript>
- system = createObject( "java", "java.lang.System" );
- itterations = 5000;
- naValues = [
- "-",
- "n. a.",
- "n.a",
- "n.a.",
- "n/a",
- "na",
- "nil",
- "nil.",
- "no boottop",
- "no info",
- "no infor",
- "no time",
- "no",
- "non",
- "none",
- "not applicable",
- "unknown"
- ];
- naValues_as_list = arrayToList( naValues, chr( 0182 ) );
- naValues_as_structkeys = {};
- for( item in naValues ) {
- structAppend( naValues_as_structkeys, item, "" );
- }
- writeDump( naValues_as_structkeys );
- ts = [];
- for ( i = 0; i < itterations; i++ ) {
- t = system.nanoTime( );
- arrayFind( naValues, "no" );
- arrayAppend( ts, system.nanoTime( )-t );
- }
- writeOutput( '<br>arrayFind = #arrayAvg( ts )#ms' );
- ts = [];
- for ( i = 0; i < itterations; i++ ) {
- t = system.nanoTime( );
- listFind( naValues_as_list, "no", chr( 0182 ) );
- arrayAppend( ts, system.nanoTime( )-t );
- }
- writeOutput( '<br>listFind = #arrayAvg( ts )#ms' );
- ts = [];
- for ( i = 0; i < itterations; i++ ) {
- t = system.nanoTime( );
- structKeyExists( naValues_as_list, "no" );
- arrayAppend( ts, system.nanoTime( )-t );
- }
- writeOutput( '<br>structKeyExists = #arrayAvg( ts )#ms' );
- </cfscript>
Add Comment
Please, Sign In to add comment