home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Pascal / BPASCAL.700 / LIB / README.DOC < prev    next >
Encoding:
Text File  |  1994-03-19  |  18.9 KB  |  374 lines

  1.      Borland-Pascal 7.0 Runtime Libary Update - Release 1.4   18-MAR-1994
  2.  
  3.  
  4.      Welcome to BPL70N15.ZIP, a collection of fast replacement libraries
  5.      for your Turbo Pascal 7.0 / Borland Pascal 7.0 compiler. There are
  6.      three libraries in this package, a real mode library (TURBO.TPL), a
  7.      DOS protected mode library (TPP.TPL), and a Windows library (TPW.TPL).
  8.      Every file is a complete replacement for the original library bearing
  9.      the same name that came with your Pascal compiler. Due to the many
  10.      optimizations in the replacement libraries, many programs compiled
  11.      with these libraries will run faster. For more detailed information
  12.      on possible performance improvements, see the file PERFORM.DOC. Only
  13.      performance information for real mode and DOS protected mode programs
  14.      can be provided at the moment.
  15.  
  16.      Those users already familiar with my previous project, the fast
  17.      replacement library for Turbo Pascal 6.0 (distributed as TPL60N19.ZIP),
  18.      may be disappointed that not all the features of that program have
  19.      been included in BPL70N15.ZIP yet. I don't have much time at the moment,
  20.      but still wanted to provide a BP 7.0 version of my library as soon as
  21.      possible. So I decided to port the performance relevant stuff first
  22.      and work on the other aspects later.
  23.  
  24.      The libaries in BPL70N15 maintain 99.9% compatibility with the original
  25.      libraries. Differences are mostly caused by bug fixes and enhancements.
  26.      Some bugs from the original libraries supplied by Borland have been
  27.      eliminated, but there can be no guarantee that new ones have not crept
  28.      in. Most of the code in the BPL70N15.ZIP libraries was ported from the
  29.      latest version of my fast replacement library for Turbo Pascal 6.0,
  30.      TPL60N19.ZIP, which has been proven to be a stable and reliable product.
  31.  
  32.      If you discover any bugs, or have other comments, please let me know.
  33.      My email and snail mail addresses are given below. Although I am under
  34.      severe time constraints, I will try as hard as possible to fix any bugs
  35.      reported in as short a time as possible.
  36.  
  37.      The legal conditions under which Borland is distributing the source code
  38.      of the Borland Pascal 7.0 run-time libraries are not entirely clear to me.
  39.      To stay on the safe side, I assume that they are the same as for the RTL
  40.      source for the TP 6.0 compiler. Under these conditions, I am not allowed
  41.      to distribute modified source modules from the library. I may only
  42.      provide the binaries to third parties. However, some of the modules in
  43.      the BPL70N15.ZIP libaries do not contain a single line of code written
  44.      by Borland and are written entirely by me. I am including the source for
  45.      these modules for your reference. The source of the arithmetic routines
  46.      can be found in the file ARISOURC.ZIP. The source code of most of the
  47.      string routines is contained in the file STRSOURC.ZIP. The code of the
  48.      arithmetic and string routines is hereby released into the public domain.
  49.      You may use it in your own programs under the condition that you do not
  50.      include it into a commercial product. Parties interested in commercial
  51.      use of my code should contact me at my address below.
  52.  
  53.  
  54.      Original library code is Copyright (C) 1983,92 Borland International
  55.  
  56.  
  57.      New / additional library code is Copyright (C) 1988-1994
  58.  
  59.      Norbert Juffa, Wielandtstr. 14, 76137 Karlsruhe, Germany
  60.      Internet: S_JUFFA@IRAVCL.IRA.UKA.DE
  61.  
  62.  
  63.  
  64.      Contents of this document:
  65.  
  66.      I.   Capabilities of RTL replacement
  67.      II.  Revision History
  68.      III. References
  69.  
  70.  
  71.  
  72.      I. Capabilities of RTL replacement
  73.      ==================================
  74.  
  75.  
  76.      General note:
  77.  
  78.      BPL70N15 provides you with optimized libraries, it does not enhance
  79.      the code produced by the Borland Pascal compiler. Thus, only code
  80.      that uses many library calls can be expected to experience significant
  81.      performance advantages. Library calls are made by BP 7.0 to operate
  82.      on LONGINTs, STRINGs, REALs, SETs, perform heap operations such as
  83.      allocating and deallocating memory (New, Dispose, GetMem, FreeMem),
  84.      as well as to perform other tasks. One exception where BPL70N15 speeds
  85.      up your code although no calls to optimized library routines are
  86.      made is floating-point applications using a 287 or 387 coprocessor.
  87.  
  88.      If want to speed up your applications even further than can be
  89.      accomplished by using BPL70N15, you might want to look at the
  90.      "Sally TPU peephole optimizer" (SPO for short) written by Morten
  91.      Welinder (terra@diku.dk). Unlike BPL70N15, this program is not in
  92.      the public domain, but Morten grants free use of the program for
  93.      personal, non-commercial use. SPO is a peephole optimizer that aims
  94.      at optimizing the code produced by the Pascal compiler. Peephole
  95.      optimizations means that the optimizer looks at a rather small
  96.      collection of machine instructions at a time and replaces certain
  97.      sequences it finds with optimized code. A TPU-optimizer speeds up
  98.      those parts of a program that can't be enhanced by a replacement
  99.      library and vice versa. So it might be a good idea to combine both
  100.      tools to get the best performance out of your BP 7.0 programs. The
  101.      SPO optimizer is currently distributed as a file SPO120.ZIP. It
  102.      should be available from all ftp-sites that carry BPL70N15 and in
  103.      particular can be downloaded from garbo.uwasa.fi, which is the upload
  104.      site for the program. Please note that this is not intended to be
  105.      an endorsement of the program. Rather, the info provided should be
  106.      thought of as being a service to those users of BPL70N15 who want
  107.      to speed up their programs even further than possible by using
  108.      BPL70N15.
  109.  
  110.  
  111.      Improvements in SYSTEM module
  112.      -----------------------------
  113.  
  114. o    REAL type software arithmetic operations now comply with ANSI/IEEE
  115.      Standard 754-1985 for Binary Floating Point Arithmetic [1,2] as much
  116.      as possible. Note that REAL arithmetic by design differs from the
  117.      standard in many ways, especially available numeric formats, value
  118.      set, and available operations. The rounding mode implemented here
  119.      is "round to nearest or even" as specified by the standard. Add,
  120.      Subtract, Multiply, Squaring, Division, and Square Root deliver
  121.      exact results with regard to this rounding mode, as demanded by the
  122.      standard. Conversions from REAL to LONGINT and from EXTENDED to REAL
  123.      use rounding to nearest or even, as specified in the standard. Correct
  124.      implementation of above features was tested with the PARANOIA test
  125.      program [3]. The correctness of basic REAL arithmetic functions has
  126.      also been tested against the coprocessor/emulator EXTENDED format
  127.      with the program FUN1_TST. The EXTENDED format carries approximately
  128.      19 decimal digits of precision. This description applies to all three
  129.      libraries in the package.
  130.  
  131. o    REAL arithmetic operations have been sped up. Speed-up for SQRT varies
  132.      between a factor of 11 for a 8086 and 30 for a 486DLC. FRAC now executes
  133.      at twice the original speed and speed-up is between 50% and 100% for
  134.      SIN, COS, ARCTAN, LN, EXP and division (2.8x speed up for division on
  135.      80386). Overall numeric processing power using REAL arithmetic increases
  136.      by about 52% for an 8086 and by 85% for an Cyrix 486DLC as measured
  137.      by the WHETSTONE benchmark [4,5]. This description applies to all three
  138.      libraries, but the actual values cited are for the real mode library
  139.      TURBO.TPL and may be different for the other libraries. In general,
  140.      DOS protected mode and Windows programs tend to be slower than real mode
  141.      programs by 5-50%.
  142.  
  143. o    Overall accuracy of REAL arithmetic transcendental functions has been
  144.      improved as indicated by Cody&Waite's ELEFUNT tests [6]: DLOG, DEXP,
  145.      DATAN, DSIN. Correct argument reduction ensures that relative error
  146.      over the whole argument range does not exceed 1.9e-12 for Exp, 2.8e-12
  147.      for Arctan, and 2.7e-12 for Ln. These values have been determined
  148.      by comparing the function returns of the REAL transcendental functions
  149.      to the values computed on a Cyrix 83D87 coprocessor for the EXTENDED
  150.      format. For Sin and Cos, relative error is also in the above range
  151.      when the argument is reasonably small (e.g. in range -100..100) and
  152.      not very close to an integer multiple of 0.25*Pi. The error of the
  153.      transcendental functions expressed in ULPs (units in the last place)
  154.      over the whole argument range does not exceed 1.6 ULPs for Exp, 1.8
  155.      ULPs for Arctan, and 2.2 ULPs for Ln. This description applies to all
  156.      three libraries in the package.
  157.  
  158. o    Execution of coprocessor floating point computations using an 80287 or
  159.      80387 has been accelerated. For these coprocessors, NOPs will be inserted
  160.      before every floating point instruction converted from an emulator
  161.      interrupt instead of WAITs. As a result of this optimization, an
  162.      improvement in execution speed of about 10% has been observed running the
  163.      Lawrence Livermore Loops (LLL) [7] on a Cyrix 83D87, the improvement
  164.      for the WHETSTONE benchmark on the 83D87 is similar. Maximum performance
  165.      gain for tight loops (e.g. fractal computation) by this measure is about
  166.      22%.
  167.  
  168. o    On 80287XL, 80387, 80486DX, or compatible chips the Sin and Cos functions
  169.      take advantage of the FSIN and FCOS instructions of these coprocessors,
  170.      speeding up these functions by almost a factor of two. As a side effect,
  171.      there is also some improvement in accuracy as measured by the DSIN test
  172.      program from the ELEFUNT test suite. Also, the Arctan function takes
  173.      advantage of the increased argument range of the FPATAN function. These
  174.      optimizations result in another 19% increase in WHETSTONE power, so
  175.      that the total combined speedup over the original library is about 30%
  176.      for this benchmark using a 387 coprocessor.
  177.  
  178. o    STRING operations are faster, especially for longer strings. Most
  179.      dramatic increase is in the INSERT function, with execution times
  180.      reduced to up to one fourth compared with the original version of
  181.      the RTL. Faster string operations cause 7% performance increase for
  182.      the DHRYSTONE [8,9] benchmark on a 8086.
  183.  
  184. o    Improved speed of random number generation. Random for REAL numbers
  185.      is 10-20% faster, Random for EXTENDED numbers is 5% faster. Due to
  186.      the improvements in the uniform distribution of integer random numbers,
  187.      there is a decrease in the speed of integer random number generation
  188.      of about 5%.
  189.  
  190. o    Binary to decimal conversions used in Str and Write procedures have
  191.      been sped up by up to 70% for integers (BYTE, SHORTINT, INTEGER,
  192.      WORD, LONGINT), up to 5% for REAL numbers and about 3% for EXTENDED
  193.      numbers.
  194.  
  195. o    Improved speed of LONGINT arithmetic for 8086..80286. Division enjoys
  196.      a 30% reduction of execution time on 8086. On 386 and 486 type CPUs,
  197.      the code used in BPL70N15 may be slower than that used by the original
  198.      library, which uses 32 bit register operations, while BPL70N15 uses
  199.      only 16 bit operations, however very cleverly. For most applications
  200.      you will not note any drop in LONGINT performance on 386/486 machines
  201.      by using BPL70N15.
  202.  
  203. o    Several of the functions of the heap manager have been tuned, resulting
  204.      in 7%-11% faster operation for these routines, depending on the CPU used.
  205.      This note applies only to the real mode heap manager in TURBO.TPL!
  206.  
  207. o    Set functions have been sped up by a few percent, but the add variable
  208.      range operation may be up to eight times as fast.
  209.  
  210. o    UPCASE function has been enhanced to support the complete IBM character
  211.      set. This means that characters ä,ü,ö,å,æ,é,ñ,ç are converted to upper
  212.      case by this function.
  213.  
  214. o    Several bugs of the original RTL supplied by Borland have been fixed:
  215.  
  216.      The original routines to perform LONGINT shifts provide the wrong results
  217.      when the program runs on a 386 or 486 type processor and the shift count
  218.      exceeds 16. This has been fixed by replacing all LONGINT routines with
  219.      my own code. My code doesn't use 386 specific instructions and foregoes
  220.      the speed advantage offered by using 32-bit register operations. For all
  221.      programs but a very few you will not notice any drop in performance on a
  222.      386-486 machine, though.
  223.  
  224.      GetDir now correctly returns a run-time error 15 (invalid drive)
  225.      when called with a non existent drive. Differing from the original,
  226.      it also signals all errors reported by DOS as run-time errors. E.g.
  227.      when applied to a floppy drive that does not contain a floppy, it
  228.      will now return run-time error 152 (drive not ready), where previously
  229.      it would incorrectly signal successful completion of the operation
  230.      (InOutRes = 0).
  231.  
  232.      For programs compiled with $N+, only true INFs are printed out as
  233.      INF where with the original library some NaNs are also printed as
  234.      INF. Correct operation can be tested with the INFBUG program.
  235.  
  236.      REAL arithmetic EXP functions no longer signals overflow when
  237.      called with small arguments, but underflows to zero instead as it
  238.      should.
  239.  
  240.      Denormals in EXTENDED computations no longer cause an invalid state
  241.      on a 8087 coprocessor when being converted to true zeros. Consistency
  242.      between register contents and tag bits is now asserted. Removal of
  243.      this bug can be tested with the BUG87 program.
  244.  
  245.      Denormals in EXTENDED format are now correctly converted to decimal
  246.      strings by the Str and Write routines. The original routines print
  247.      EXTENDED precision denormals as zero. Note that BP 7.0 supports
  248.      EXTENDED denormals only if your machine has an 80287XL, 80387, 80486
  249.      or equivalent. On the 8087 and Intel's original 80287 coprocessor
  250.      denormals are only supported for the SINGLE and DOUBLE formats. Correct
  251.      printing of extended precision denormals can be checked with the
  252.      program DENORMTS.
  253.  
  254.      Program initialization routine now tries to prevent that programs
  255.      compiled with the $G+ (286 code generation) switch are run on 8086
  256.      and 8088. The checks done are not 100% safe, but catch most of these
  257.      cases, displaying the message "CPU > 8086 required" and aborting the
  258.      program with a return code of 254 ($FE) instead of letting it crash.
  259.      Note that this check lets programs compiled with $G+ run on 80186 and
  260.      V20/V30 processors, since they have the ability to execute all 80286
  261.      real mode instructions produced by Turbo Pascal. This note applies
  262.      only to real mode programs, as DOS protected mode and Windows programs
  263.      will not run on anything less than a 286 anyhow.
  264.  
  265.  
  266.  
  267.      Improvements in CRT module
  268.      --------------------------
  269.  
  270. o    Bug fix in routine DirectWrite. The method used to prevent "snow"
  271.      when writing directly to a CGA graphics card was not entirely safe.
  272.      When used in a heavily interrupted program (e.g. serial communication
  273.      as a background task), it would not always write during the time
  274.      when scanning was in the invisible parts of the screen. The method
  275.      used now is 100% save and is even faster, since it takes advantage
  276.      of the horizontal and vertical retrace periods, as opposed to the
  277.      old method which only used the horizontal retrace time. The new
  278.      routine has been tested successfully on an original IBM-CGA card.
  279.  
  280.  
  281.  
  282.      II. Revision History
  283.      ====================
  284.  
  285. o    Changes since version 1.4, dated 01-07-1994
  286.  
  287.      When fixing the bug in the Str function in the Windows library
  288.      TPW.TPL for machines without a math coprocessor in version 1.4,
  289.      I accidentally broke the code for machines that do have a math
  290.      coprocessor. Thanks to Siegfried Voessner (VOESSNERQFTUG.AC.AT)
  291.      for reporting this bug.
  292.  
  293.  
  294. o    Changes since version 1.3, dated 10-24-1993
  295.  
  296.      Fixed bug in the Str function in the Windows library TPW.TPL that
  297.      caused the Str function to abort with run time error 207 when passed
  298.      a non-zero argument on a PC without a math coprocessor. The bug
  299.      was caused by the inability of Windows' coprocessor emulator to
  300.      correctly emulate the FBSTP instruction. Many thanks to Eduardo
  301.      Mauro (eduardo.mauro@bbs816.mandic.onsp.br) for reporting this bug
  302.      and helping me to track it down.
  303.  
  304.  
  305. o    Changes since version 1.2, dated 05-20-1993
  306.  
  307.      Fixed bug in the code of the Instr function. The previously provided
  308.      code did not work correctly when compiled with the $G+ option. Thanks
  309.      to Flurin Honegger (honegger@urz.unibas.ch) for reporting this bug.
  310.  
  311.  
  312.      Changes since version 1.1, dated 03-15-1993
  313.  
  314. o    Fixed bug in the Write and WriteLn routines of the CRT unit. Due to
  315.      this bug, these routines could not function properly on a Hercules
  316.      Graphics Card or other monochrome display. Thanks to Miha Vitorovic
  317.      (Miha.Vitorovic@f108.n380.z2.fidonet.org) for reporting this bug.
  318.  
  319.  
  320.      Changes since version 1.0, dated 03-10-1993
  321.  
  322. o    Fixed bug in LONGINT and REAL Val routine. Val erroneously returned
  323.      the wrong value or an error code for syntactically correct strings.
  324.      Thanks to Dennis J. Basiaga (dennisb@dancer.cc.bellcore.com), who was
  325.      the first to report this bug.
  326.  
  327.  
  328.      Version 1.0, original release.
  329.  
  330.  
  331.  
  332.      III. References
  333.      ===============
  334.  
  335. [1]  IEEE: IEEE Standard for Binary Floating-Point Arithmetic.
  336.      SIGPLAN Notices, Vol. 22, No. 2, 1985, pp. 9-25
  337.  
  338. [2]  IEEE Standard for Binary Floating-Point Arithmetic.
  339.      ANSI/IEEE Std 754-1985.
  340.      New York, NY: Institute of Electrical and Electronics Engineers 1985
  341.  
  342. [3]  Karpinski, R.: Paranoia: A Floating-Point Benchmark.
  343.      Byte, February 1985, pp. 223-235
  344.  
  345. [4]  Curnow, H.J.; Wichmann, B.A.: A synthetic benchmark.
  346.      Computer Journal, Vol. 19, No. 1, 1976, pp. 43-49
  347.  
  348. [5]  Wichmannn, B.A.: Validation code for the Whetstone benchmark.
  349.      NPL Report DITC 107/88, National Physics Laboratory, UK, March 1988
  350.  
  351. [6]  Cody, W.J.; Waite, W.: Software Manual for the Elementary Functions.
  352.      Englewood Cliffs, NJ: Prentice Hall 1980
  353.  
  354. [7]  McMahon, H.H.: The Livermore Fortran Kernels: A Test of the Numerical
  355.      Performance Range.
  356.      Technical Report UCRL-53745, Lawrence Livermore National Laboratory,
  357.      December 1986, p. 179
  358.  
  359. [8]  Weicker, R.P.: Dhrystone: A Synthetic Systems Programming Benchmark.
  360.      Communications of the ACM, Vol. 27, No. 10, October 1984, pp. 1013-1030
  361.  
  362. [9]  Weicker, R.P.: Dhrystone Benchmark: Rationale for Version 2 and
  363.      Measurement Rules.
  364.      SIGPLAN Notices, Vol. 23, No. 8, August 1988, pp. 49-62
  365.  
  366. [10] 387DX User's Manual, Programmer's Reference. Intel 1989
  367.  
  368.  
  369.      Note:
  370.  
  371.      PARANOIA, DHRYSTONE, WHETSTONE, LLL, and ELEFUNT source code is
  372.      available from NETLIB@ORNL.GOV
  373.  
  374.