REBOL Technologies

Introducing the SPEED? Function (PRELIMINARY)

Carl Sassenrath, CTO
REBOL Technologies
16-Jan-2011 20:18 GMT

Article #0506
Main page || Index || Prior Article [0505] || Next Article [0507] || 7 Comments || Send feedback

Some of you know that there's a handy script on the REBOL website called speed.r. I use it quite often to get a general idea of the performance of various systems I work on.

For example, I'm writing this article from cheap Linux box that's not that fast. I can find out how well it runs REBOL with:

>> do http://www.rebol.com/speed.r
connecting to: www.rebol.com
Script: "REBOL Quick and Dirty Speed Test" (none)
Running...
........................................................................

Console:   0:00:00.319016 - 1586 KC/S
Processor: 0:00:00.392543 - 2201 RHz (REBOL-Hertz)
Memory:    0:00:02.547215 - 18 MB/S
Disk/File: 0:00:00.762555 - 40 MB/S

BTW, an RHz ~= MHz. The scale difference in intentional. You know, "planning for future expansion."

So... this speed check isn't an advanced benchmark, but I've found it to be quite useful. Last summer I was working with someone on firing up a hosted virtual server. When I ran the speed.r test, I discovered that the disk/file test was only about 8 MB/S! (I've got 12 year-old 400 MHz PC's that run that fast.)

I contacted the ISP and after quite a lot of arm twisting I got them to measure the disk speed (using an independent method.) They were quite surprised how bad it was! We moved the server twice before landing on one that ran about 10 times faster... and, for the same price.

After that experience I decided to write speed? and make the speed test resident to all future R2 and R3 releases.

>> ? speed?
USAGE:
   SPEED? /no-io /times 

DESCRIPTION:
    Returns approximate speed benchmarks [eval cpu memory file-io].
    SPEED? is a function value.

REFINEMENTS:
    /no-io -- Skip the I/O test
    /times -- Show time for each test

The /no-io option is for when you're running from a mem-card (SD flash) or other device that you don't want to wear out.

The result is a block of numbers that you can easily format:

b: speed?
print [
   "evaluation:" b/1 lf
   "cpu:" b/2 lf
   "memory:" b/3 lf
   "file:" b/4
]

If you want to peek at the source (and it's pretty small), type:

source speed?

Note that it's not exactly the same as speed.r. I wanted to measure the interpreter's evaluation speed and CPU speed more independently. My goal was for those first two numbers to fall close to the MHz for your system, given adequate CPU caching with good DDR clocking (and of course, minimal task loading.)

Also note that this is just a preliminary version. If you have some improvements, let me know. But, also keep in mind, this is just a simple built-in test not used by most scripts, so it needs to stay quite small.

7 Comments

Updated 13-Nov-2024   -   Copyright Carl Sassenrath   -   WWW.REBOL.COM   -   Edit   -   Blogger Source Code