Jump to content

FastCode

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by DennisFastcode (talk | contribs) at 10:59, 20 January 2011 (Structure). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

FastCode is an open source programming project aimed at providing enhanced runtime library routines for Embarcadero Delphi and C++ Builder. Since it was started in 2003 by Dennis Kjaer Christensen, it has contributed highly optimised functionality to the Embarcadero RTL. FastCode is unique among contributions to commercial compiler runtime libraries for its community-driven and open source nature.

Structure

The project is organized as a competition divided into challenges. Each challenge takes one function and optimizes it against a number of targets. The project provides tools for benchmarking and validating each function contribution. One point is given per contribution (maximally one function per target is given points) and tens points are awarded for a target winner. A list with all contributors and their scores is maintained, and at the end of each year a winner is celebrated. Borland, Codegear and Embarcadero, the owners of Delphi and C++ Builder, have historically sponsored prizes.

The majority of participants in the competition are assembler developers who often utilize processor-specific code and extra instruction sets, such as MMX, SSE, SSE2, SSE3, SSSE3 and SSE4[1].

The project enjoys the support of Embarcadero who recognizes the contributions of the FastCode team and incorporates their code into the codebase for Delphi[2]. The default memory manager for Embarcadero Delphi, FastMM4, is the winner of the FastCode Memory Manager challenge[3].

The project was first hosted on Robert Lee's OptimalCode site, and its source code's current home is [FastCode Web Site][4].

Testing

The FastCode project puts a lot of effort into testing and focus is on providing very high quality SW. Testing is split into two categories - testing for correctness and testing for speed.

Validation

Validation is done on all CPU's from the target set and very often on other CPU's and OS's (Windows XP, Vista, 7 etc.) as well.

Benchmarking

Benchmarking is done on all the CPU's (Intel Pentium 3[5], Intel Core[6], Intel Core2[7], AMD Athlon XP[8], AMD Phenom[9]) that are part of the current target set.

List of Challenges

The FastCode project has run the following challenges:

  • AES (Advanced Encryption Standard)
  • AnsiStringReplace
  • ArcCos
  • ArcSin
  • Ceil32
  • Ceil64
  • CharPos
  • CharPosIEx
  • CharPosEy
  • CharPosRev
  • CompareMem
  • CompareStr
  • CompareText
  • Fillchar
  • Floor32
  • Floor64
  • GCD32 (Greatest Common Divisor 32 bit)
  • IDCT (Inverse Discrete Cosine Transform)
  • Int64Div
  • Int64Mul
  • IntToStr
  • IsPrime
  • LowerCase
  • MaxFP
  • MaxInt
  • MaxInt64
  • Memory Manager
  • MinFP
  • MinInt
  • MinInt64
  • Move
  • Polar Complex Number Addition
  • Polar Complex Number Subtraction
  • Polar Complex Number Multiplication
  • Polar Complex Number Division
  • Polar To Rectangular Format Conversion
  • Pos
  • PosEx
  • PosIEx
  • Power
  • Rectangular Complex Number Addition
  • Rectangular Complex Number Subtraction
  • Rectangular Complex Number Multiplication
  • Rectangular Complex Number Division
  • Rectangular To Polar Format Conversion
  • RGBA To BGRA (Bitmap Format Conversion)
  • Round
  • RoundToEx
  • Round32
  • Scale Down (Bitmap Scaling)
  • Sort
  • StrComp
  • StrCopy
  • StrIComp
  • StrLen
  • StrLComp
  • StrLIComp
  • StrToInt32
  • Trim
  • TList.Sort
  • Trunc
  • Trunc32
  • UpperCase
  • Val

Contributions to Delphi RTL

FastCode functions included in the Delphi RTL:

  • Delphi 2005: CompareText, Int64Div and FillChar
  • Delphi 2006: CompareText, Int64Div and FillChar, FastMM4 memory manager [10]
  • Delphi 2007—Delphi XE: ArcCos, ArcSin, Power, PosEx, Move, Memory Manager, FillChar, Pos, __lldiv, LowerCase, UpperCase, CompareStr, CompareMem, CompareText, StrLen, StrCopy, StrComp. [11]

The FastCode Library

All the challenge winners are included in the FastCode library (http://fastcode.sourceforge.net/challenge_content/rtl_replcmnt_pkg.html). This library is open source, released under the MPL license.

FastMM4 Memory Manager

The FastMM memory manager used by Delphi and C++ Builder since 2006 is also the winner of a FastCode competition.

References