Article View: comp.lang.pascal.borland
Article #540Re: Speed of Delete - improvement
From: Mike
Date: Wed, 19 Nov 1997 00:00
Date: Wed, 19 Nov 1997 00:00
70 lines
2856 bytes
2856 bytes
This is a multi-part message in MIME format. --------------5C292E8C546A Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Dr John Stockton wrote: [...] > That has an incompatible parameter list, and will go SPLAT if Index<0 or > Count<0 or Index>255 or Count>255; and so cannot always be used as a > replacement for Sys.Delete (some programs may rely on surviving these). > Otherwise, it looks much like Mike's, should have similar performance to > ours; I'll pop it in my program, but some of the comments I posted about > Mike's will apply. [...] John, You are right - the extra error-checking in your routine adds only about 8% to the overhead. I used Jim Lemay's Rate61 method to find out how many repetitions occur in a fixed interval. The results on a P100 are shown below (the results may fluctuate 1% or so, but they are consistent.) ------------------------------------------------------- Borland Pascal Version 7.0 Copyright (c) 1983,92 Borland International TSTSTR.PAS(281) 281 lines, 0.1 seconds, 7376 bytes code, 904 bytes data. Starting Rate Test... Dr. Stockton's error-checking version: Operations/sec = 563,627 Mike's trust-the-programmer version: Operations/sec = 613,948 ------------------------------------------------------- I suppose the overhead from the call and return, plus the actual move instruction, overwhelms the extra error-checking used in your routine. Obviously, when you need a general-purpose routine that has to guard against parameter errors, your is the better choice. The full source is attached (TSTSTR.ZIP, 2,861 bytes) Best Regards, Mike CEO, Analog & Digital Design Automated Production Test http://www.csolve.net/~add/home.htm Hosting Jonathan Ramsey's Pascal TCP/IP for DOS: http://www.csolve.net/~add/zips/tcp.htm --------------5C292E8C546A Content-Type: application/zip Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="TSTSTR.ZIP" <encoded_portion_removed> --------------5C292E8C546A--
Technical Details
Message-ID:
<34732BAD.BDB@short.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<s2qpaAAJUIc0EwPB@merlyn.demon.co.uk> <DBS2jCAmrdc0Ew4E@merlyn.demon.co.uk> <Mj9fjAAGehc0EwaJ@pedt.demon.co.uk> <0dhDgGAl9ic0EwO7@merlyn.demon.co.uk>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10261c,9e270db731f7d69c X-Google-Attributes: gid10261c,public X-Google-Thread: 108ebd,9e270db731f7d69c X-Google-Attributes: gid108ebd,public X-Google-Thread: 111659,9e270db731f7d69c X-Google-Attributes: gid111659,public From: Mike <internal@short.net> Subject: Re: Speed of Delete - improvement Date: 1997/11/19 Message-ID: <34732BAD.BDB@short.net> X-Deja-AN: 290764907 References: <s2qpaAAJUIc0EwPB@merlyn.demon.co.uk> <DBS2jCAmrdc0Ew4E@merlyn.demon.co.uk> <Mj9fjAAGehc0EwaJ@pedt.demon.co.uk> <0dhDgGAl9ic0EwO7@merlyn.demon.co.uk> Organization: UTS Newsgroups: comp.lang.pascal.borland,comp.lang.pascal.misc,borland.public.turbopascal