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

(defun t_ssget_layer ( count fptr / time1 time2 filter en ss )
  (setq en (entmakex (list (cons 0 "POINT")(cons 8 "193")(cons 10 '(0 0 0)))))
  ;;-----------------------------
  (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 filter '((8 . "193")))
  ;;-----------------------------
  (setq time1 (getvar "MILLISECS"))
  (if (not time1) (setq time1 (getvar "TDUSRTIMER")))
  (if (not time1) (setq time1 0.0))

  (repeat count
    (ssget "X" filter)
  )

  (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 filter Layer : " (rtos bench$seconds 2 3) "\n"))
  (if fptr
    (princ (strcat "* SSGET filter Layer : " (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_layer (* 5000 $benchcyclesfactor) nil)
  (setvar "cmdecho" 1)
  (princ)
)
