Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!convex!tchrist@convex.COM From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.lang.perl Subject: Re: speed: V2 verses V3 Message-ID: <4047@convex.UUCP> Date: 17 Dec 89 19:13:28 GMT References: <1808@uvaarpa.virginia.edu> <6609@jpl-devvax.JPL.NASA.GOV> Sender: usenet@convex.UUCP Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 96 >I'd be more interested in comparisons of text processing performance. >You'll probably find that some tasks are a lot faster, some are a little >faster, and some are a little slower. Hopefully a net gain. Here are some timings on text handling. The program is a quickie to extract all termcap entries that match the command arguments, inspired by from Larry's lib/termcap.pl Tgetent() routine. Here are the relevant data: % wc /etc/termcap 2235 8179 102598 /etc/termcap % grep -n 'wyse50[:|]' /etc/termcap 2060:ye|w50|wyse50|Wyse 50:\ % cat gent $| = 1; $\ = "\n"; for $arg (@ARGV) { do gentry($arg); } sub gentry { local ($entry) = @_; $TERMCAP = '/etc/termcap'; open TERMCAP || die "can't open $TERMCAP: $!\n"; while () { next if /^#/; next if /^\t/; next unless /^(\S*\|)?${entry}[|:]/; chop; while (chop eq '\\') { $_ .= ; chop; } $_ .= ':'; s/:\t*:/:/g; print; } } C1 timings: (32 meg) c-120% time perl2 gent wyse50 wyse50 wyse50 > /dev/null 10.5u 1.9s 0:13 89% 0+0k 33+0io 60pf+0w c-120% time perl3 gent wyse50 wyse50 wyse50 > /dev/null 6.9u 0.6s 0:08 89% 0+8k 0+1io 67pf+0w C2 timings: (128 meg) c-220% time perl2 gent wyse50 wyse50 wyse50 > /dev/null 2.4u 0.7s 0:03 82% 0+0k 25+0io 46pf+0w c-220% time perl3 gent wyse50 wyse50 wyse50 > /dev/null 1.6u 0.1s 0:01 92% 0+0k 7+0io 51pf+0w Extended precision C2 timings: c-220% /bin/time -e perl2 gent wyse50 wyse50 wyse50 > /dev/null 3.884330 real 2.448687 user 0.760707 sys c-220% /bin/time -e perl3 gent wyse50 wyse50 wyse50 > /dev/null 2.737149 real 1.709143 user 0.164598 sys That means that for THIS application on THESE architectures and THESE configurations, perl3 runs in 2/3 the user time that perl2 does on both architectures, and just 1/3 and 1/5 system time respectively on a c1 and a c2. (The difference in system time ratios MAY be because the c1 was running ConvexOS 7.1 the c2 had version 8.0 instead.) This is sure a pretty nice overall performance increase in my book. Oddly enough, on a diskless sun/350 with 4 meg of memory, there was little variance in user time (5%) but a 50% speedup in system time between perl2 and perl3. Another interesting note is that if you combine these these 2 statments: next if /^#/; next if /^\t/; into next if /^#/ || /^\t/; then your user time goes from 1.7 to 2.0 on the c2 for perl3, but if you instead make them: next if /^[#\t]/; it doesn't change. Interesting optimizations going on here somewhere. What kinds of ratios do people get for other machines? --tom DISCLAIMER: These timings should not be construed to be official benchmarks from my employer, whom I do not represent in this capacity. They are presented only to illustrate ratios between perl2 and perl3. Tom Christiansen {uunet,uiucdcs,sun}!convex!tchrist Convex Computer Corporation tchrist@convex.COM "EMACS belongs in : Editor too big!"