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

(defun t_vl_vector_project_pointonentity ( count fptr / doc ms box circ face
                                                        pBox vBox pTop vTop
                                                        time1 time2 )

  ;;--- build data list
  (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
  (setq ms  (vla-get-Modelspace doc))

  (vla-AddBox ms (vlax-3d-point 0 0 0) 4 4 4)
  (setq box (entlast))
  (setq pBox '(-10 0 0) vBox '(2 0 0))

  (vla-AddCircle ms (vlax-3d-point 0 0 0) 2)
  (setq circ (entlast))
  (setq pTop '(1 1 10) vTop '(0 0 -1))

  (vla-Add3dFace ms (vlax-3d-point 0 0 0) (vlax-3d-point 2 0 0) (vlax-3d-point 2 2 0) (vlax-3d-point 0 2 0))
  (setq face (entlast))

  ;;--- now run test : VLE
  (setq time1 (getvar "MILLISECS"))
  (if (not time1) (setq time1 (getvar "TDUSRTIMER")))
  (if (not time1) (setq time1 0.0))

  (repeat count
    (vl-vector-project-PointToEntity pBox vBox box)
    (vl-vector-project-PointToEntity pTop vTop circ)
    (vl-vector-project-PointToEntity pTop vTop face)
  )

  (setq time2 (getvar "MILLISECS"))
  (if (not time2) (setq time2 (getvar "TDUSRTIMER")))
  (if (not time2) (setq time2 0.0))

  (entdel box)
  (entdel circ)
  (entdel face)

  ;;--- test results
  (setq bench$seconds (if hasMilliSecs (* 0.001 (- time2 time1)) (* 86400.0 (- time2 time1))))
  (princ (strcat "* VL-VECTOR-PROJECT-POINTTOENTITY : " (rtos bench$seconds 2 3) "\n"))
  (if fptr
    (princ (strcat "* VL-VECTOR-PROJECT-POINTTOENTITY : " (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_vl_vector_project_pointonentity (* 2000 $benchcyclesfactor) nil)
  (setvar "cmdecho" 1)
  (princ)
)
