|View script||License||Download documentation as: HTML or editable||Download script||History|
Script Library: 1231 scripts
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 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
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 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.
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.