Documention for: timepage.r Created by: btiffin on: 10-May-2007 Format: text/editable Downloaded on: 29-Mar-2024 [h1 Usage document for %timepage.r, %timesites.r and %timewebs.r [contents [numbering-on [h2 Introduction to timing web page reads. [p These scripts are examples of timing web page reads. [p This usage document also highlights other timing related scripts, and some of this information is shared among the documentation. [p This document is shared for all three sample web page timing scripts. [p This paragraph keeps the floating table of contents from obscuring pertinent information. [h2 timepage At a Glance [asis/style/font-size:75% >> 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 asis] [h2 timesites At a Glance [asis/style/font-size:75% >> 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 asis] [h2 timewebs At a Glance [asis/style/font-size:75% >> 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 asis] [h2 The problem with one second resolution [p 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. [h2 Timing related scripts [table/att/border="1px"/style/font-size:75% [row [cell [link http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=timeit.r "%timeit.r" [cell A simple timing function [row [cell [link http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=timeblk.r "%timeblk.r" [cell Times a block of code. Allows for repetitions. [row [cell [link http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=timepage.r "%timepage.r" [cell Times how long it takes to read a web page [row [cell [link http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=timesites.r "%timesites.r" [cell Times how long each read of a block of web pages takes [row [cell [link http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=timewebs.r "%timewebs.r" [cell Similar to %timesites.r, but keeps timings in a block [row [cell [link http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=profiler.r "%profiler.r" [cell Sophisticated timing of REBOL code sections [row [cell [link http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=profile-timer.r "%profile-timer.r" [cell Sophisticated timing of REBOL code sections, with named events. [row [cell [link http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=timer-style.r "%timer-style.r" [cell A graphical timer, with example start, stop, reset and save. [row [cell [link http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=remind.r "%remind.r" [cell An example of setting a reminder timer, that can email the reminder [row [cell [link http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=now.r "%now.r" [cell A simple script to find out your age in seconds. [row [cell [link http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=set-prompt.r "%set-prompt.r" [cell An example of setting the console prompt. Sets prompt to show current time and current directory. [row [cell [link http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=form-date.r "%form-date.r" [cell Not really a timer, but can format timing output ala strftime table] [h2 Another excellent timing script, not in the library, [link http://www.fm.vslib.cz/~ladislav/rebol/timblk.r "Ladislav's precise timing" is a very precise timing script, includes time-block, and time-tick. Returns the system clock tick-time on execution. [h2 Using the web page timers. [p There are a few changes that can be made to these scripts. The scripts in the repository, are samples. [h3 Running the timers [p These utilities are simple to use. Just <strong>DO</strong> it. [asis >> do %timewebs.r asis] [h4 Another timing toolkit [p For comprehensive named events with cumulative times, take a look at [br [link http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=profile-timer.r "%profile-timer.r" [h3 Direct execution from the library [p These script can all be executed directly from the library [asis/style/font-size:75% >> do http://www.rebol.org/cgi-bin/cgiwrap/rebol/download-a-script.r?script-name=timesites.r asis] but that won't give you information on sites you may actually care to time. [h2 What you can learn [p How easy it is to read a web page in REBOL. **read url!**. [p 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. [p 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. [h3 Only the text is timed [p 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. [h2 What can break [p Not much to break here, but inaccessible sites may cause an error condition. [p A midnight rollover will give wonky results. [p With a fast processor, or fast network, you may get a lot of 0:00 second results. [h2 Credits [table/att/border="1px" [row [cell %timepage.r [cell Original author: Unknown [row [cell %timesites.r [cell Original author: Unknown [row [cell %timewebs.r [cell Original author: Unknown table] [list [li The rebol.org Library Team [li Usage document by Brian Tiffin, Library Team Apprentice, [date list]