Author Topic: (and (or *acad*  (Read 19124 times)

0 Members and 2 Guests are viewing this topic.

JohnK

  • Administrator
  • Seagull
  • Posts: 10604
Re: (and (or *acad*
« Reply #15 on: August 30, 2011, 01:36:02 PM »
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

JohnK

  • Administrator
  • Seagull
  • Posts: 10604
Re: (and (or *acad*
« Reply #16 on: August 30, 2011, 01:37:13 PM »
...
PS: If you really want to split hairs the IF code is about 10% faster than the equivalent COND code. :P

Interesting.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
Re: (and (or *acad*
« Reply #17 on: August 30, 2011, 01:39:15 PM »
...
PS: If you really want to split hairs the IF code is about 10% faster than the equivalent COND code. :P

Interesting.

Logical ...


*grin*
TheSwamp.org  (serving the CAD community since 2003)

BlackBox

  • King Gator
  • Posts: 3770
Re: (and (or *acad*
« Reply #18 on: August 30, 2011, 01:39:59 PM »
Code: [Select]
(defun setq->cond ()
  (setq *acadobject*
         (cond
           (*acadobject*)
           ((vlax-get-acad-object)))))

(defun cond->setq ()
  (cond
    (*acadobject*)
    ((setq *acadobject* (vlax-get-acad-object)))))

(defun setq->if  ()
  (setq *acadobject*
         (if *acadobject*
           *acadobject*
           (vlax-get-acad-object))))

(setq *acadobject* nil)

(bench '(setq->cond) '() 10000000)

(setq *acadobject* nil)

(bench '(cond->setq) '() 10000000)

(setq *acadobject* nil)

(bench '(setq->if) '() 10000000)

Results:

Code: [Select]
SETQ->COND
Elapsed: 31918
Average: 0.0032

COND->SETQ
Elapsed: 33150
Average: 0.0033

Command: 'VLIDE
SETQ->IF
Elapsed: 31029
Average: 0.0031

Edit: Not quite 10% faster (as advertised), rather only +/-1% on average over 10000000 iterations. LoL

Edit: CORRECTION, my fat fingers typed incorrectly... (* 100.0 (/ (- 33150 31029) 33150.0)) is +/-6%. My bad.
« Last Edit: August 30, 2011, 02:44:35 PM by RenderMan »
"How we think determines what we do, and what we do determines what we get."

JohnK

  • Administrator
  • Seagull
  • Posts: 10604
Re: (and (or *acad*
« Reply #19 on: August 30, 2011, 01:42:32 PM »
...
PS: If you really want to split hairs the IF code is about 10% faster than the equivalent COND code. :P
Interesting.
Logical ...
*grin*

Are you sure you don't have anywhere else to be?

*bigger grin*
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

JohnK

  • Administrator
  • Seagull
  • Posts: 10604
Re: (and (or *acad*
« Reply #20 on: August 30, 2011, 01:44:22 PM »
Thanks for assembling that test RenderMan.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
Re: (and (or *acad*
« Reply #21 on: August 30, 2011, 01:45:50 PM »
Are you sure you don't have anywhere else to be?
*bigger grin*
You're right, I hear the Lagniappe forum calling me ...

get outta here ya crazy coders

LOL
TheSwamp.org  (serving the CAD community since 2003)

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: (and (or *acad*
« Reply #22 on: August 30, 2011, 01:46:03 PM »
Edit: Not quite 10% faster (as advertised), rather only +/-1% on average over 10000000 iterations. LoL



Code: [Select]
Elapsed milliseconds / relative speed for 65536 iteration(s):

    (SETQ *ACAD* (IF *ACAD* *ACAD* (vlax...).....1375 / 1.10 <fastest>
    (SETQ *ACAD* (COND (*ACAD*) ((vlax-g...).....1515 / 1.00 <slowest>
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

BlackBox

  • King Gator
  • Posts: 3770
Re: (and (or *acad*
« Reply #23 on: August 30, 2011, 01:47:30 PM »
Found the writeup I did and posted.

Link: http://www.theswamp.org/index.php?topic=28433.msg340206#msg340206

... Only skimmed, but looks 'neat' (yes, 'cause I'm a geek)

Thanks for assembling that test RenderMan.

'Welcome; interesting that the write up sites Robert Bell, who wrote the Bench.lsp I used for the test! LoL

"How we think determines what we do, and what we do determines what we get."

BlackBox

  • King Gator
  • Posts: 3770
Re: (and (or *acad*
« Reply #24 on: August 30, 2011, 01:50:33 PM »
Edit: ^^ LoL

Edit: Not quite 10% faster (as advertised), rather only +/-1% on average over 10000000 iterations. LoL



Code: [Select]
Elapsed milliseconds / relative speed for 65536 iteration(s):

    (SETQ *ACAD* (IF *ACAD* *ACAD* (vlax...).....1375 / 1.10 <fastest>
    (SETQ *ACAD* (COND (*ACAD*) ((vlax-g...).....1515 / 1.00 <slowest>

Show me the 10%....

<snip>

Results:

Code: [Select]
SETQ->COND
Elapsed: 31918
Average: 0.0032

COND->SETQ
Elapsed: 33150
Average: 0.0033

Command: 'VLIDE
SETQ->IF
Elapsed: 31029
Average: 0.0031

Edit: Not quite 10% faster (as advertised), rather only +/-1% on average over 10000000 iterations. LoL
"How we think determines what we do, and what we do determines what we get."

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: (and (or *acad*
« Reply #25 on: August 30, 2011, 01:52:54 PM »
Show me the 10%....

Sorry, can't help you with your math skills.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
Re: (and (or *acad*
« Reply #26 on: August 30, 2011, 01:54:21 PM »
The 'Visual' in AutoLISP (Vanilla / Visual) doesn't mean that.
TheSwamp.org  (serving the CAD community since 2003)

BlackBox

  • King Gator
  • Posts: 3770
Re: (and (or *acad*
« Reply #27 on: August 30, 2011, 01:55:08 PM »
Show me the 10%....

Sorry, can't help you with your math skills.

Yeah... Guess you'd require having some math skills, to do that, huh?  :-D
"How we think determines what we do, and what we do determines what we get."

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: (and (or *acad*
« Reply #28 on: August 30, 2011, 01:55:38 PM »
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
Re: (and (or *acad*
« Reply #29 on: August 30, 2011, 01:57:36 PM »
TheSwamp.org  (serving the CAD community since 2003)