(setq hasMilliSecs (/= (getvar "MILLISECS") nil))
(setvar "LOGFILEMODE" 0)

(defun t_assoc ( count fptr / time1 time2 lst )
  ;;------ build test data ------
  (setq lst
   '(
      (0   . "XXX")
      (1   . "XXX")
      (2   . "XXX")
      (3   . "XXX")
      (4   . "XXX")
      (5   . "XXX")
      (1.0 . "XXX")
      (2.0 . "XXX")
      (3.0 . "XXX")
      (4.0 . "XXX")
      (5.0 . "XXX")
      ("A" . "XXX")
      ("B" . "XXX")
      ("X" . "XXX")
    )
  )
  ;;-----------------------------
  (setq time1 (getvar "MILLISECS"))
  (if (not time1) (setq time1 (getvar "TDUSRTIMER")))
  (if (not time1) (setq time1 0.0))

  (repeat (* count count)
    (assoc  1    lst)
    (assoc  5    lst)
    (assoc  "A"  lst)
    (assoc  "B"  lst)
    (assoc  1.0  lst)
    (assoc  5.0  lst)
    (assoc  "X"  lst)
    (assoc  "Y"  lst)
  )

  (setq time2 (getvar "MILLISECS"))
  (if (not time2) (setq time2 (getvar "TDUSRTIMER")))
  (if (not time2) (setq time2 0.0))
  ;;-----------------------------
  (setq bench$seconds (if hasMilliSecs (* 0.001 (- time2 time1)) (* 86400.0 (- time2 time1))))
  (princ (strcat "* ASSOC : " (rtos bench$seconds 2 3) "\n"))
  (if fptr
    (princ (strcat "* ASSOC : " (rtos bench$seconds 2 3) "\n") fptr)
  )
  bench$seconds
)

;; to increase/decrease the number of bench loops : > 1 increase < 1 decrease
(if (not $benchcyclesfactor) (setq $benchcyclesfactor 1))

;; to run this loaded test manually
(defun C:Run ()
  (setvar "cmdecho" 0)
  (print)
  (t_assoc (* 500 $benchcyclesfactor) nil)
  (setvar "cmdecho" 1)
  (princ)
)
