Script Library: 1219 scripts
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 
View scriptLicenseDownload documentation as: HTML or editable
Download scriptHistoryOther scripts by: carl

Documentation for: timepage.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 web page timing scripts.

This paragraph keeps the floating table of contents from obscuring pertinent information.

2. timepage At a Glance

 >> 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
 

3. timesites At a Glance

 >> 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
 

4. timewebs At a Glance

 >> 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
 

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
%profile-timer.r 

8.2. Direct execution from the library

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.r
 
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.

11. Credits

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