Script Library: 1219 scripts
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

Documentation for: timewebs.r

Usage document for %timepage.r, %timesites.r and %timewebs.r

1. Introduction to timing web page reads.

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 webpage timing scripts.

This paragraph keeps the table on contents from obscuring pertinent information.

2. timepage At a Glance

 >> do
 connecting to:
 Script: "Time a Web Page" (24-Apr-1999)
 connecting to:

3. timesites At a Glance

 >> do
 connecting to:
 Script: "Time Several Web Sites" (24-Apr-1999)
 connecting to:
 Time for was 0:00
 connecting to:
 Time for was 0:00:01
 connecting to:
 Time for was 0:00:04

4. timewebs At a Glance

 >> do
 connecting to:
 Script: "Time Web Pages" (18-Dec-1997)
 connecting to:
 connecting to:
 connecting to:
 connecting to:
 connecting to:
 connecting to:
 0:00:01 3956
 0:00 9385
 0:00:01 3071
 0:00 7195
 0:00:01 106893
 0:00 90288

5. The problem with one second resolution

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.

6. Timing related scripts

%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

7. Another excellent timing script, not in the library,

Ladislav's precise timing  is a very precise timing script, includes time-block, and time-tick. Returns the system clock tick-time on execution.

8. Using the web page timers.

There are a few changes that can be made to these scripts. The scripts in the repository, are samples.

8.1. Running the timers

These utilities are simple to use. Just DO it.

 >> do %timewebs.r

8.1.1. Another timing toolkit

For comprehensive named events with cumulative times, take a look at

8.2. Direct execution from the library

These script can all be executed directly from the library

 >> do
but that won't give you information on sites you may actually care to time.

9. What you can learn

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.

9.1. Only the text is timed

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.

10. What can break

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.

These samples define global variables. Not a good practice for shared scripts.

11. Credits

%timepage.r Original author: Unknown
%timesites.r Original author: Unknown
%timewebs.r Original author: Unknown
  • The Library Team
  • Usage document by Brian Tiffin, Library Team Apprentice, Last updated: 10-May-2007