FOCAL (programming Language) - Efficiency

Efficiency

FOCAL ran on very low-end PDP-8 systems, even systems with only 4K words of memory and lacking mass storage. The FOCAL interpreter was written in very tight assembly language and typically used only 3K 12-bit words, leaving a somewhat limiting 1K words to hold the user program, and variables.

If the system was upgraded by adding one or more extra 4K banks of memory, FOCAL could use that extra memory, either for a single user, or split the extra memory across several time-sharing users. FOCAL made extensive use of interrupt-driven terminal I/O, so it could keep four teleprinters busily whirring with nary a pause.

Memory space was too precious for storing textual error messages, so FOCAL used a clever work-around: error messages instead displayed the start address of the error-managing routine as a floating-point number. For example, in the FOCAL-69 implementation the division by zero error was managed by code starting at memory address octal 4333; division by zero at a program line numbered 01.10 produced the error message ?28.73 @ 01.10, where 28.73 represents memory page 28 plus an offset of 73 words. Most FOCAL sites had an "error number to error message" listing taped up near the terminals.

Comparisons between FOCAL and BASIC were inevitable since both languages were common on smallish computers of the same era. FOCAL lacked inherent support for strings as data elements which could be assigned to variables. This is generally thought to be a serious deficiency as compared to the string capabilities in most BASICs. This deficiency, while serious, was not as utterly crippling as it might sound. A surprising amount of string usage in FOCAL programs is devoted to formatting user output. Since FOCAL output was character-stream-oriented, outputting two strings sequentially could sometimes substitute for concatenating them, and procedural tools could be written for performing complex formatted output.

A limited amount of string input could be done, so a program could ask simple Yes/No questions, but this was really a kludge. For example, if you typed "HELLO" at an input statement, FOCAL would convert the H to "8", then interpret the "E" as starting an exponent, then it would try to compute "8" to the "LLO" power, which would take several seconds of CPU time and result in a value of 0.76593020E+103, not a particularly helpful response.

It is generally agreed that FOCAL was more efficient in its use of resources than comparable BASIC systems. On a typical machine of the day (often with 6 to 24 kilobytes of core memory), FOCAL could handle larger and more complex programming tasks than BASIC.

FOCAL's PDP-8 implementation used a floating point representation that represented numbers as four 12-bit words, with thirty-six bits of mantissa and twelve bits of exponent. This allowed for both significantly higher precision and a significantly wider range of values than most other low-end programming systems, and made it a reasonable choice for serious numerical work. This high precision, and good choices for default decimal output formatting, meant that difficulties with binary-to-decimal rounding were not evident to beginning users.

Read more about this topic:  FOCAL (programming Language)

Famous quotes containing the word efficiency:

    “Never hug and kiss your children! Mother love may make your children’s infancy unhappy and prevent them from pursuing a career or getting married!” That’s total hogwash, of course. But it shows on extreme example of what state-of-the-art “scientific” parenting was supposed to be in early twentieth-century America. After all, that was the heyday of efficiency experts, time-and-motion studies, and the like.
    Lawrence Kutner (20th century)

    I’ll take fifty percent efficiency to get one hundred percent loyalty.
    Samuel Goldwyn (1882–1974)

    Nothing comes to pass in nature, which can be set down to a flaw therein; for nature is always the same and everywhere one and the same in her efficiency and power of action; that is, nature’s laws and ordinances whereby all things come to pass and change from one form to another, are everywhere and always; so that there should be one and the same method of understanding the nature of all things whatsoever, namely, through nature’s universal laws and rules.
    Baruch (Benedict)