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

(defun t_simpleand0 ( count fptr / time1 time2 )
  ;;-----------------------------
  (setq time1 (getvar "MILLISECS"))
  (if (not time1) (setq time1 (getvar "TDUSRTIMER")))
  (if (not time1) (setq time1 0.0))

  (repeat (* count count)
    (and)
  )

  (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 "* Simple AND 0 : " (rtos bench$seconds 2 3) "\n"))
  (if fptr
    (princ (strcat "* Simple AND 1 : " (rtos bench$seconds 2 3) "\n") fptr)
  )
  bench$seconds
)
(defun t_simpleandT ( count fptr / time1 time2 )
  ;;-----------------------------
  (setq time1 (getvar "MILLISECS"))
  (if (not time1) (setq time1 (getvar "TDUSRTIMER")))
  (if (not time1) (setq time1 0.0))

  (repeat count
    (repeat (1- count)
      (and T)
    )
  )

  (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 "* Simple AND T : " (rtos bench$seconds 2 3) "\n"))
  (if fptr
    (princ (strcat "* Simple AND T : " (rtos bench$seconds 2 3) "\n") fptr)
  )
  bench$seconds
)
(defun t_simpleandNIL ( count fptr / time1 time2 )
  ;;-----------------------------
  (setq time1 (getvar "MILLISECS"))
  (if (not time1) (setq time1 (getvar "TDUSRTIMER")))
  (if (not time1) (setq time1 0.0))

  (repeat count
    (repeat (1- count)
      (and NIL)
    )
  )

  (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 "* Simple AND NIL : " (rtos bench$seconds 2 3) "\n"))
  (if fptr
    (princ (strcat "* Simple AND NIL : " (rtos bench$seconds 2 3) "\n") fptr)
  )
  bench$seconds
)
(defun t_simpleandTT ( count fptr / time1 time2 )
  ;;-----------------------------
  (setq time1 (getvar "MILLISECS"))
  (if (not time1) (setq time1 (getvar "TDUSRTIMER")))
  (if (not time1) (setq time1 0.0))

  (repeat count
    (repeat (1- count)
      (and T T)
    )
  )

  (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 "* Simple AND T T : " (rtos bench$seconds 2 3) "\n"))
  (if fptr
    (princ (strcat "* Simple AND T T : " (rtos bench$seconds 2 3) "\n") fptr)
  )
  bench$seconds
)

(defun t_simpleor0 ( count fptr / time1 time2 )
  ;;-----------------------------
  (setq time1 (getvar "MILLISECS"))
  (if (not time1) (setq time1 (getvar "TDUSRTIMER")))
  (if (not time1) (setq time1 0.0))

  (repeat count
    (repeat (1- count)
      (or)
    )
  )

  (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 "* Simple OR 0 : " (rtos bench$seconds 2 3) "\n"))
  (if fptr
    (princ (strcat "* Simple OR 0 : " (rtos bench$seconds 2 3) "\n") fptr)
  )
  bench$seconds
)
(defun t_simpleorT ( count fptr / time1 time2 )
  ;;-----------------------------
  (setq time1 (getvar "MILLISECS"))
  (if (not time1) (setq time1 (getvar "TDUSRTIMER")))
  (if (not time1) (setq time1 0.0))

  (repeat count
    (repeat (1- count)
      (or T)
    )
  )

  (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 "* Simple OR T : " (rtos bench$seconds 2 3) "\n"))
  (if fptr
    (princ (strcat "* Simple OR T : " (rtos bench$seconds 2 3) "\n") fptr)
  )
  bench$seconds
)
(defun t_simpleorNIL ( count fptr / time1 time2 )
  ;;-----------------------------
  (setq time1 (getvar "MILLISECS"))
  (if (not time1) (setq time1 (getvar "TDUSRTIMER")))
  (if (not time1) (setq time1 0.0))

  (repeat count
    (repeat (1- count)
      (or NIL)
    )
  )

  (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 "* Simple OR NIL : " (rtos bench$seconds 2 3) "\n"))
  (if fptr
    (princ (strcat "* Simple OR NIL : " (rtos bench$seconds 2 3) "\n") fptr)
  )
  bench$seconds
)
(defun t_simpleorNILT ( count fptr / time1 time2 )
  ;;-----------------------------
  (setq time1 (getvar "MILLISECS"))
  (if (not time1) (setq time1 (getvar "TDUSRTIMER")))
  (if (not time1) (setq time1 0.0))

  (repeat count
    (repeat (1- count)
      (or NIL T)
    )
  )

  (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 "* Simple OR NIL T : " (rtos bench$seconds 2 3) "\n"))
  (if fptr
    (princ (strcat "* Simple OR NIL T : " (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_simpleand0 (* 100 $benchcyclesfactor) nil)
  (t_simpleandT (* 100 $benchcyclesfactor) nil)
  (t_simpleandNIL (* 100 $benchcyclesfactor) nil)
  (t_simpleandTT (* 100 $benchcyclesfactor) nil)
  (t_simpleor0 (* 100 $benchcyclesfactor) nil)
  (t_simpleorT (* 100 $benchcyclesfactor) nil)
  (t_simpleorNIL (* 100 $benchcyclesfactor) nil)
  (t_simpleorNILT (* 100 $benchcyclesfactor) nil)
  (setvar "cmdecho" 1)
  (princ)
)
