明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1926|回复: 2

测试程序运行效率程序

[复制链接]
发表于 2008-3-4 13:21:00 | 显示全部楼层 |阅读模式
本帖最后由 作者 于 2008-3-4 19:01:15 编辑
  1. ;;;测试程序运行效率程序-----------------------------------------
  2. (defun gps->test (lst / rlst rmax rxlst start-time tlst x y z)
  3. (setq tlst lst)
  4. (setq rlst (mapcar
  5.       '(lambda (x)
  6.   (setq start-time (getvar "cdate"))
  7.   (eval x)
  8.   (* 1000000 (- (getvar "cdate") start-time))
  9.        )
  10.       tlst
  11.     )
  12. )
  13. (setq rmax  (apply 'max rlst))
  14. (setq rxlst (mapcar
  15.        '(lambda (x)
  16.           (cond ((= 0 x) "∞")
  17.          (T (/ rmax x))
  18.          )
  19.         )
  20.        rlst
  21.      )
  22. )
  23. (princ "\n测试程序......流逝时间(秒)......相对速度")
  24.   (mapcar
  25.     '(lambda (x y z)
  26.        (mapcar
  27.   'princ
  28.   (list "\n"  x "......" y "......" z)
  29.        )
  30.      )
  31.     tlst
  32.     rlst
  33.     rxlst
  34.   )
  35. (princ)
  36. )
  37. ;;;示例:---------------------------------------------------
  38. (defun test1 (ss)
  39.   (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
  40. )
  41. (defun test2 (ss / n l)
  42.   (repeat (setq n (sslength ss))
  43.     (setq l (cons (ssname ss (setq n (1- n))) l))
  44.   )  
  45. )
  46. (defun test3 (ss / n e l)
  47.   (setq n -1)
  48.   (while (setq e (ssname ss (setq n (1+ n))))
  49.     (setq l (cons e l))
  50.   )
  51. )
  52. ;|
  53. 命令: (setq ss (ssget))      
  54. 命令: (gps->test '((test1 ss) (test2 ss) (test3 ss)))
  55.       测试程序......流逝时间(秒)......相对速度
  56.       (TEST1 SS)......1.04308......1.0
  57.       (TEST2 SS)......0.111759......9.33333
  58.       (TEST3 SS)......0.0782311......13.3333
  59. e.g.
  60. (gps->test '((c:pw) (c:wq)))
  61. |;
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2013-4-4 12:14:34 | 显示全部楼层
老大的源码,竟然没有顶过!!
发表于 2013-4-4 19:39:49 | 显示全部楼层
同顶,,,,,,
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-5-30 22:46 , Processed in 0.187596 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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