(setq hasMilliSecs (/= (getvar "MILLISECS") nil))
(setvar "LOGFILEMODE" 0)
(vl-load-com)

(defun t_vlax-safearray-type ( count fptr / time1 time2 
                                            intArr lngArr fltArr dblArr strArr objArr bolArr varArr )

  ;;-----------------------------
  (setq intArr (vlax-make-safearray vlax-vbInteger '(0 . 1)))
  (setq lngArr (vlax-make-safearray vlax-vbLong    '(0 . 1)))
  (setq fltArr (vlax-make-safearray vlax-vbSingle  '(0 . 1)))
  (setq dblArr (vlax-make-safearray vlax-vbDouble  '(0 . 1)))
  (setq strArr (vlax-make-safearray vlax-vbString  '(0 . 1)))
  (setq objArr (vlax-make-safearray vlax-vbObject  '(0 . 1)))
  (setq bolArr (vlax-make-safearray vlax-vbBoolean '(0 . 1)))
  (setq varArr (vlax-make-safearray vlax-vbVariant '(0 . 1)))
  ;;-----------------------------
  (setq time1 (getvar "MILLISECS"))
  (if (not time1) (setq time1 (getvar "TDUSRTIMER")))
  (if (not time1) (setq time1 0.0))

  (repeat (* count count)
    (vlax-safearray-type intArr)
    (vlax-safearray-type lngArr)
    (vlax-safearray-type fltArr)
    (vlax-safearray-type dblArr)
    (vlax-safearray-type strArr)
    (vlax-safearray-type objArr)
    (vlax-safearray-type bolArr)
    (vlax-safearray-type varArr)
  )

  (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 "* VLAX-SAFEARRAY-TYPE : " (rtos bench$seconds 2 3) "\n"))
  (if fptr
    (princ (strcat "* VLAX-SAFEARRAY-TYPE : " (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_vlax-safearray-type (* 600 $benchcyclesfactor) nil)
  (setvar "cmdecho" 1)
  (princ)
)
