These scripts are examples of timing web page reads.
This usage document also highlights other timing related scripts, and some of this information is shared among the documentation.
This document is shared for all three sample web page timing scripts.
This paragraph keeps the floating table of contents from obscuring pertinent information.
>> do http://www.rebol.org/cgi-bin/cgiwrap/rebol/download-a-script.r?script-name=timepage.r connecting to: www.rebol.org Script: "Time a Web Page" (24-Apr-1999) connecting to: www.rebol.com 0:00
>> do http://www.rebol.org/cgi-bin/cgiwrap/rebol/download-a-script.r?script-name=timesites.r connecting to: www.rebol.org Script: "Time Several Web Sites" (24-Apr-1999) connecting to: www.rebol.com Time for http://www.rebol.com was 0:00 connecting to: www.cnet.com Time for http://www.cnet.com was 0:00:01 connecting to: www.hotwired.com Time for http://www.hotwired.com was 0:00:04
>> do http://www.rebol.org/cgi-bin/cgiwrap/rebol/download-a-script.r?script-name=timewebs.r connecting to: www.rebol.org Script: "Time Web Pages" (18-Dec-1997) connecting to: www.pacific.net connecting to: www.rebol.com connecting to: www.sassenrath.com connecting to: www.cucug.org connecting to: www.cnn.com connecting to: www.cnet.com 0:00:01 http://www.pacific.net 3956 0:00 http://www.rebol.com 9385 0:00:01 http://www.sassenrath.com 3071 0:00 http://www.cucug.org 7195 0:00:01 http://www.cnn.com 106893 0:00 http://www.cnet.com 90288
As you will have noticed, most faster links report 0:00. A simple change to these scripts, changing now/time to now/time/precise will help give better resolutions.
%timeit.r | A simple timing function |
%timeblk.r | Times a block of code. Allows for repetitions. |
%timepage.r | Times how long it takes to read a web page |
%timesites.r | Times how long each read of a block of web pages takes |
%timewebs.r | Similar to %timesites.r, but keeps timings in a block |
%profiler.r | Sophisticated timing of REBOL code sections |
%profile-timer.r | Sophisticated timing of REBOL code sections, with named events. |
%timer-style.r | A graphical timer, with example start, stop, reset and save. |
%remind.r | An example of setting a reminder timer, that can email the reminder |
%now.r | A simple script to find out your age in seconds. |
%set-prompt.r | An example of setting the console prompt. Sets prompt to show current time and current directory. |
%form-date.r | Not really a timer, but can format timing output ala strftime |
There are a few changes that can be made to these scripts. The scripts in the repository, are samples.
These utilities are simple to use. Just DO it.
>> do %timewebs.r
For comprehensive named events with cumulative times, take a look at
%profile-timer.r
These script can all be executed directly from the library
>> do http://www.rebol.org/cgi-bin/cgiwrap/rebol/download-a-script.r?script-name=timesites.rbut that won't give you information on sites you may actually care to time.
How easy it is to read a web page in REBOL. read url!.
The %timewebs.r has the most to learn from. It defines a block of sites, and a separate block of timings, with examples of getting at fields in a block, using series! operations.
The time refinement of the now native function, now/time has a resolution of 1 second. Most new machines can cut through a lot of REBOL code in 1 second. More comprehensive timing utilities will use now/time/precise, for much finer grained timings. Faster links will also require more precise timing than these fairly old examples.
Note: These scripts only time the textual portion of a page. A browser will also download the images, execute any embedded scripts, etcetera. This will almost always take longer than the times shown here.
Not much to break here, but inaccessible sites may cause an error condition.
A midnight rollover will give wonky results.
With a fast processor, or fast network, you may get a lot of 0:00 second results.
%timepage.r | Original author: Unknown |
%timesites.r | Original author: Unknown |
%timewebs.r | Original author: Unknown |