Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!convex!tchrist From: tchrist@convex.com (Tom Christiansen) Newsgroups: comp.lang.perl Subject: next if C VS if (C) { next } Message-ID: <1991May22.021106.13838@convex.com> Date: 22 May 91 02:11:06 GMT Sender: usenet@convex.com (news access account) Organization: CONVEX Computer Corporation, Richardson, Tx., USA Lines: 32 Nntp-Posting-Host: pixel.convex.com Wondering how badly people who code like C instead of BASIC-PLUS fair in the timing arena, I wrote a mini-benchmark: VERSION 1: for ($i = 0; $i < 100000; $i++) { if ($i) { next; } } VERSION 2: for ($i = 0; $i < 100000; $i++) { next if $i; } Consistently I got this kind of timing behavior. % time perl ptest.1 10.670u 9.105s 0:22.58 87.5% 0+0k 0+1io 36pf+0w % time perl ptest.2 5.690u 0.071s 0:06.54 88.0% 0+0k 1+0io 36pf+0w What the devil is going on here to incur two orders of magnitude more system time, not to mention double the user time??? Some kind of longjmp foo you don't see in the BASIC-PLUS style? Larry, if you're out there, what gives? --tom -- Tom Christiansen tchrist@convex.com convex!tchrist "So much mail, so little time."