LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (November 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 15 Nov 2004 10:23:21 -0500
Reply-To:     "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Subject:      Why would TRANWRD be faster than COMPRESS ?

In this case, tranwrd appears to be ~22% faster than compress. Why would that be ?

543 data _null_;* / debug; 544 source = "Some ABCABCA String containing overlap ABCA"; 545 excerpt = "ABCA"; 546 547 n = 1e7; 548 549 t0 = datetime(); 550 do i = 1 to n; s = compress(source,excerpt); end; 551 t1 = datetime(); 552 do i = 1 to n; s = tranwrd (source,excerpt,''); end; 553 t2 = datetime(); 554 555 e1=t1-t0; 556 e2=t2-t1; 557 558 put e1=/e2=; 559 run;

e1=3.9690001011 e2=3.0929999352 NOTE: DATA statement used (Total process time): real time 7.06 seconds cpu time 7.06 seconds

560 561 * swap location of compress and tranwrd ; 562 563 data _null_;* / debug; 564 565 source = "Some ABCABCA String containing overlap ABCA"; 566 excerpt = "ABCA"; 567 568 n = 1e7; 569 570 t0 = datetime(); 571 do i = 1 to n; s = tranwrd (source,excerpt,''); end; 572 t1 = datetime(); 573 do i = 1 to n; s = compress(source,excerpt); end; 574 t2 = datetime(); 575 576 577 e1=t1-t0; 578 e2=t2-t1; 579 580 put e1=/e2=; 581 run;

e1=3.2030000687 e2=4.125 NOTE: DATA statement used (Total process time): real time 7.32 seconds cpu time 7.32 seconds

-- Richard A. DeVenezia http://www.devenezia.com/


Back to: Top of message | Previous page | Main SAS-L page