Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #15358
| From | mhx@iae.nl (Marcel Hendrix) |
|---|---|
| Subject | Re: Buffer access with bounds checking... |
| Newsgroups | comp.lang.forth |
| Message-ID | <83929202948435@frunobulax.edu> (permalink) |
| Date | 2012-09-01 11:11 +0200 |
| References | <8017764.GPyE82yXzj@sunwukong.fritz.box> |
| Organization | Wanadoo |
Bernd Paysan <bernd.paysan@gmx.de> writes Re: Buffer access with bounds checking...
[..]
> You should run some benchmarks which one is faster - IMHO just writing
> two variables and not checking if they have already been used is faster.
> And you definitely should check close to the range ends (checking is
> done with 64 bit Gforth):
[..]
Your scheme is faster, but not much.
#100000000 VALUE #times
: stest ( -- )
CR ." (Paysan) #times = " #times U>D (n,3)
CR ." protected: " timer-reset
#times 0 ?DO foo #88 + b@
foo #80 + b@ +
foo #72 + b@ +
foo #64 + b@ + DROP
LOOP
.elapsed
CR ." UNprotected: " timer-reset
#times 0 ?DO foo #88 + @
foo #80 + @ +
foo #72 + @ +
foo #64 + @ + DROP
LOOP
.elapsed ;
FORTH> stest
#times = 100,000,000
protected: 1.273 seconds elapsed.
UNprotected: 0.345 seconds elapsed. ok
Mark's:
100 buffer fred
: test
fred dup sizeOf 0 do
i over i + bc!
loop drop ;
: stest2 ( -- )
CR ." (Wills) #times = " #times U>D (n,3)
CR ." protected: " timer-reset
#times 0 ?DO fred #88 + b@
fred #80 + b@ +
fred #72 + b@ +
fred #64 + b@ + DROP
LOOP
.elapsed
CR ." UNprotected: " timer-reset
#times 0 ?DO fred #88 + @
fred #80 + @ +
fred #72 + @ +
fred #64 + @ + DROP
LOOP
.elapsed ;
FORTH> stest2
#times = 100,000,000
protected: 1.827 seconds elapsed.
UNprotected: 0.720 seconds elapsed. ok
-marcel
Back to comp.lang.forth | Previous | Next — Previous in thread | Find similar | Unroll thread
Buffer access with bounds checking... Mark Wills <markrobertwills@yahoo.co.uk> - 2012-08-31 06:51 -0700
Re: Buffer access with bounds checking... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-08-31 11:04 -0500
Re: Buffer access with bounds checking... Alex McDonald <blog@rivadpm.com> - 2012-08-31 09:20 -0700
Re: Buffer access with bounds checking... Mark Wills <markrobertwills@yahoo.co.uk> - 2012-08-31 12:57 -0700
Re: Buffer access with bounds checking... "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-08-31 18:46 -0400
Re: Buffer access with bounds checking... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-09-01 04:05 -0500
Re: Buffer access with bounds checking... "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-09-01 13:45 -0400
Re: Buffer access with bounds checking... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-09-02 04:19 -0500
Re: Buffer access with bounds checking... "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-09-02 16:15 -0400
Re: Buffer access with bounds checking... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-09-04 12:02 -0500
Re: Buffer access with bounds checking... Doug Hoffman <glidedog@gmail.com> - 2012-08-31 14:15 -0400
Re: Buffer access with bounds checking... Mark Wills <markrobertwills@yahoo.co.uk> - 2012-08-31 12:56 -0700
Re: Buffer access with bounds checking... Paul Rubin <no.email@nospam.invalid> - 2012-08-31 13:32 -0700
Re: Buffer access with bounds checking... Doug Hoffman <glidedog@gmail.com> - 2012-08-31 17:45 -0400
Re: Buffer access with bounds checking... Paul Rubin <no.email@nospam.invalid> - 2012-08-31 15:07 -0700
Re: Buffer access with bounds checking... Mark Wills <forthfreak@gmail.com> - 2012-09-01 00:49 -0700
Re: Buffer access with bounds checking... Paul Rubin <no.email@nospam.invalid> - 2012-09-01 14:06 -0700
Re: Buffer access with bounds checking... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-09-02 04:21 -0500
Re: Buffer access with bounds checking... anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-09-02 10:27 +0000
Re: Buffer access with bounds checking... Doug Hoffman <glidedog@gmail.com> - 2012-09-01 06:59 -0400
Re: Buffer access with bounds checking... humptydumpty <ouatubi@gmail.com> - 2012-08-31 14:21 -0700
Re: Buffer access with bounds checking... "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-08-31 18:48 -0400
Re: Buffer access with bounds checking... Bernd Paysan <bernd.paysan@gmx.de> - 2012-09-01 01:41 +0200
Re: Buffer access with bounds checking... Bernd Paysan <bernd.paysan@gmx.de> - 2012-09-01 02:37 +0200
Re: Buffer access with bounds checking... mhx@iae.nl (Marcel Hendrix) - 2012-09-01 11:11 +0200
csiph-web