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

(defun t_ssget_layerMulti ( count fptr / time1 time2 filterMulti en )
  ;;-----------------------------
  (if (not (tblobjname "LAYER" "1"))
    (command "_layer" "_new"
      "1,2,3,4,5,6,7,8,9,10,11,18,19,21,22,23,24,25,26,27,28,29"
      ""
    )
  )
  (setq filterMulti
    '((-4 . "<OR")
      (8 . "1")
      (8 . "2")
      (8 . "3")
      (8 . "4")
      (8 . "5")
      (8 . "6")
      (8 . "7")
      (8 . "8")
      (8 . "9")
      (8 . "10")
      (-4 . "OR>")
     )
  )
  (setq en (entmakex (list (cons 0 "POINT")(cons 8 "10")(cons 10 '(0 0 0)))))
  ;;-----------------------------
  (setq time1 (getvar "MILLISECS"))
  (if (not time1) (setq time1 (getvar "TDUSRTIMER")))
  (if (not time1) (setq time1 0.0))

  (repeat count
    (ssget "X" filterMulti)
  )

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

(defun t_ssget_layerSingle ( count fptr / time1 time2 filterSingle en )
  ;;-----------------------------
  (if (not (tblobjname "LAYER" "1"))
    (command "_layer" "_new"
      "1,2,3,4,5,6,7,8,9,10,11,18,19,21,22,23,24,25,26,27,28,29"
      ""
    )
  )
  (setq filterSingle '((8 . "1,2,3,4,5,6,7,8,9,10")))
  (setq en (entmakex (list (cons 0 "POINT")(cons 8 "10")(cons 10 '(0 0 0)))))
  ;;-----------------------------
  (setq time1 (getvar "MILLISECS"))
  (if (not time1) (setq time1 (getvar "TDUSRTIMER")))
  (if (not time1) (setq time1 0.0))

  (repeat count
    (ssget "X" filterSingle)
  )

  (setq time2 (getvar "MILLISECS"))
  (if (not time2) (setq time2 (getvar "TDUSRTIMER")))
  (if (not time2) (setq time2 0.0))
  ;;-----------------------------
  (entdel en)
  ;;-----------------------------
  (setq bench$seconds (if hasMilliSecs (* 0.001 (- time2 time1)) (* 86400.0 (- time2 time1))))
  (princ (strcat "* SSGET filterSingle : " (rtos bench$seconds 2 3) "\n"))
  (if fptr
    (princ (strcat "* SSGET filterSingle : " (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_ssget_layerMulti  (* 5000 $benchcyclesfactor) nil)
  (t_ssget_layerSingle (* 5000 $benchcyclesfactor) nil)
  (setvar "cmdecho" 1)
  (princ)
)
