天气与日历 切换到窄版

 找回密码
 立即注册
中国膜结构网
十大进口膜材评选 十大国产膜材评选 十大膜结构设计评选 十大膜结构公司评选
查看: 88|回复: 0

lisp测试速度

[复制链接]
  • TA的每日心情
    开心
    2024-8-31 15:58
  • 签到天数: 89 天

    [LV.6]常住居民II

    488

    主题

    207

    回帖

    3366

    积分

    管理员

    积分
    3366
    发表于 2024-6-22 09:46:18 | 显示全部楼层 |阅读模式
    [code](defun c:test (/ N L)
      (initget 7)
      (setq N (fix (getreal "\n请输入数组的长度(Please Enter the number of list):")))
      (setq L (GetRandList 0 N N))

      (benchMark '(Msort L) "MyMergesort" 10)              ;--highflybird's
      (benchMark '(QuickSort L) "QuickSort" 10)             ;--gile's
      (benchMark '(MergeSort L) "MergeSort" 10)           ;--gile's
      (benchMark '(eea-sort L) "EEA-Sort" 10)                ;-- ElpanovEvgeniy's
      (benchMark '(vl-sort L '<) "vl-sort" 10)
    )
    [/code]

    [code];;;============================================================
    ;;;&#27979;&#35797;&#29992;&#20989;&#25968;(benchMark function)                              
    ;;;============================================================
    (defun Benchmark (func funName times / t0 t1 res)
      (setq t0 (getvar "TDUSRTIMER"))
      (repeat times
        (setq res (eval func))
      )
      (setq t1 (* (- (getvar "TDUSRTIMER") t0) 86400))
      
      (princ (strcat "\n\nIt takes: " (rtos t1 2 6) " Seconds  by  " funName))
      (princ (strcat ".\nTotal times: " (itoa times)))
      (princ (strcat ".\nSpeed is: " (rtos (/ t1 times) 2 6) " Seconds/times."))
      ;(princ "\nThe result is: ")
      ;(princ res)
    )


    ;;;---------------------------------------------------------------------
    ;;;Definine Rand()              
    ;;;---------------------------------------------------------------------
    (defun GetRandList(a b n / str scr lst)
      (setq scr (vlax-create-object "ScriptControl"))                       ;Create a script
      (vlax-put scr 'Language "VBS")
      (setq str "Randomize\nFunction Rand(x,y)\nRand=x+Rnd*(y-x)\nEnd Function")
                                                                            ;for randomize some features
      (vlax-invoke Scr 'ExecuteStatement str)                               ;Execute script
      (defun Rand (scr nMin nMax)                                           ;Rand function
        (vlax-invoke scr 'run "Rand" nMin nMax)
      )
      (repeat n
        (setq lst (cons (rand scr a b) lst))
      )
      (vlax-release-object scr)
      lst
    )[/code]

     

     

     

     

    lisp测试速度
    中国膜结构网打造全中国最好的膜结构综合平台 ,统一协调膜结构设计,膜结构施工,膜材采购,膜材定制,膜结构预算全方位服务。 中国空间膜结构协会合作单位。
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|Archiver|手机版|中国膜结构网|中国膜结构协会|进口膜材|国产膜材|ETFE|PVDF|PTFE|设计|施工|安装|车棚|看台|污水池| |网站地图

    GMT+8, 2024-9-8 10:46 , Processed in 0.066983 second(s), 27 queries .

    Powered by Discuz! X3.5

    © 2001-2024 Discuz! Team.

    快速回复 返回顶部 返回列表