Guest User

Untitled

a guest
Jul 18th, 2018
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. <cfscript>
  2. system = createObject( "java", "java.lang.System" );
  3. itterations = 5000;
  4. naValues = [
  5. "-",
  6. "n. a.",
  7. "n.a",
  8. "n.a.",
  9. "n/a",
  10. "na",
  11. "nil",
  12. "nil.",
  13. "no boottop",
  14. "no info",
  15. "no infor",
  16. "no time",
  17. "no",
  18. "non",
  19. "none",
  20. "not applicable",
  21. "unknown"
  22. ];
  23. naValues_as_list = arrayToList( naValues, chr( 0182 ) );
  24. naValues_as_structkeys = {};
  25. for( item in naValues ) {
  26. structAppend( naValues_as_structkeys, item, "" );
  27. }
  28.  
  29. writeDump( naValues_as_structkeys );
  30.  
  31. ts = [];
  32. for ( i = 0; i < itterations; i++ ) {
  33. t = system.nanoTime( );
  34. arrayFind( naValues, "no" );
  35. arrayAppend( ts, system.nanoTime( )-t );
  36. }
  37. writeOutput( '<br>arrayFind = #arrayAvg( ts )#ms' );
  38.  
  39.  
  40. ts = [];
  41. for ( i = 0; i < itterations; i++ ) {
  42. t = system.nanoTime( );
  43. listFind( naValues_as_list, "no", chr( 0182 ) );
  44. arrayAppend( ts, system.nanoTime( )-t );
  45. }
  46. writeOutput( '<br>listFind = #arrayAvg( ts )#ms' );
  47.  
  48.  
  49. ts = [];
  50. for ( i = 0; i < itterations; i++ ) {
  51. t = system.nanoTime( );
  52. structKeyExists( naValues_as_list, "no" );
  53. arrayAppend( ts, system.nanoTime( )-t );
  54. }
  55. writeOutput( '<br>structKeyExists = #arrayAvg( ts )#ms' );
  56. </cfscript>
Add Comment
Please, Sign In to add comment