Banner showing base of Eiffel tower

Github

Download version 1.4.8: Windows or Linux

Benchmark: Eiffel-Loop Code Performance Benchmarks

This project has 104 classes.

ECF: benchmark.ecf

Source code: directory list

SUB-APPLICATIONS

The benchmark application has a total of 4 sub-applications that each serve a different purpose and can be reached with a command option obtained by lower-casing the class name and removing the "_app" suffix.

EL_APPLICATION*
   PRIMES_BENCHMARK_APP
   EL_COMMAND_LINE_APPLICATION* [${C -> EL_APPLICATION_COMMAND}]
      EL_COMMAND_SHELL_APPLICATION* [${C -> EL_APPLICATION_COMMAND_SHELL}]
         BENCHMARK_APP
         STRING_BENCHMARK_APP
      ZSTRING_BENCHMARK_APP

HEIRARCHY

The descendants of EL_BENCHMARK_COMPARISON below were created to benchmark particular code characteristics. Any of the benchmarks can be run from a menu shell.

The class DEVELOPER_COMPARISON is used to create throw-away benchmarks that answer particular questions. After benchmarking new code, it is discarded but the results are documented in the section "Benchmark Journal" below.

EL_BENCHMARK_COMPARISON*
   STRING_BENCHMARK_COMPARISON*
      SUBSTRING_INDEX_COMPARISON
      ZSTRING_DEVELOPER_COMPARISON
      ARRAYED_INTERVAL_LIST_COMPARISON
      IMMUTABLE_STRING_SPLIT_COMPARISON
      LINE_STATE_MACHINE_COMPARISON
      MAKE_GENERAL_COMPARISON
      STRING_ITEM_8_VS_ITEM
      REPLACE_SUBSTRING_ALL_VS_GENERAL
      COMPACT_SUBSTRINGS_32_ITERATION_COMPARISON
      COMPACT_SUBSTRINGS_32_BUFFERING_COMPARISON
      UNICODE_ITEM_COMPARISON
      ZCODEC_AS_Z_CODE
      ZSTRING_APPEND_GENERAL_VS_APPEND
      ZSTRING_APPEND_Z_CODE_VS_APPEND_CHARACTER
      ZSTRING_AREA_ITERATION_COMPARISON
      ZSTRING_INTERVAL_SEARCH_COMPARISON
      ZSTRING_SAME_CHARACTERS_COMPARISON
      ZSTRING_SPLIT_COMPARISON
      ZSTRING_TOKENIZATION_COMPARISON
      ZSTRING_UNICODE_TO_Z_CODE
      STRING_SPLIT_ITERATION_COMPARISON
      IF_ATTACHED_ITEM_VS_CONFORMING_INSTANCE_TABLE
      ZSTRING_SPLIT_LIST_COMPARISON
      STRING_CONCATENATION_COMPARISON
      STRING_8_TWIN_VS_SCOPE_COPIED_ITEM
   ARRAYED_VS_HASH_SET_SEARCH
   ATTACH_TEST_VS_BOOLEAN_COMPARISON
   BIT_POP_COUNT_COMPARISON
   BIT_SHIFT_COUNT_COMPARISON
   CLASS_ID_ENUM_VS_TYPE_OBJECT
   DIRECTORY_WALK_VS_FIND_COMMAND
   HASH_TABLE_VS_NAMEABLES_LIST_SEARCH
   LIST_ITERATION_COMPARISON
   P_I_TH_LOWER_UPPER_VS_INLINE_CODE
   REFLECTED_REFERENCE_VS_OPTIMIZED_FIELD_RW
   ROUTINE_CALL_ON_ONCE_VS_EXPANDED
   SYSTEM_TIME_COMPARISON
   TOKENIZED_STEPS_VS_XPATH_STRING
   ARRAYED_VS_LINKED_LIST
   STRING_8_SPLIT_VS_SPLIT_ON_CHARACTER_8
   COMPACTABLE_REFLECTIVE_VS_MANUAL_BIT_MASK
   DEVELOPER_COMPARISON

BENCHMARK JOURNAL

23 March 2025

Find fastest way to test detachable representation to increment the counter. The fastest method is to test if representation = Void. Other methods are 1/3 slower.

when 1 then
   if attached {EL_STRING_FIELD_REPRESENTATION [INTEGER, ANY]} representation as l_rep then
      do_nothing
   else
      counter := counter + 1
   end

when 2 then
   if representation = Void then
      counter := counter + 1

   elseif attached {EL_STRING_FIELD_REPRESENTATION [INTEGER, ANY]} representation as l_rep then
      do_nothing
   end

when 3 then
   if has_representation
      and then attached {EL_STRING_FIELD_REPRESENTATION [INTEGER, ANY]} representation as l_rep
   then
      do_nothing
   else
      counter := counter + 1
   end

Passes over 500 millisecs (in descending order)

method 2 :  47911.0 times (100%)
method 3 :  32334.0 times (-32.5%)
method 1 :  31783.0 times (-33.7%)

6 October 2024

Finding a ZSTRING type at the end of list of 500 STRING_8 objects.

Result := across string_general_list as list
   1. some list.item.generating_type = {ZSTRING}
   2. some {ISE_RUNTIME}.dynamic_type (list.item) = ZSTRING -- THE WINNER
   3. some {ISE_RUNTIME}.dynamic_type (list.item) = ({ZSTRING}).type_id
   4. some list.item.same_type (Zstring_object)
end

Passes over 2000 millisecs (in descending order)

method 2 :  65.0 times (100%)
method 4 :  63.0 times (-3.1%)
method 3 :  18.0 times (-72.3%)
method 1 :  15.0 times (-76.9%)

26 August 2024

Testing if ZSTRING conforms to READABLE_STRING_32 using class EL_INTERNAL and EL_CLASS_TYPE_ID_ENUM

when 1 then
   Result := attached {READABLE_STRING_32} str
when 2 then
   Result := field_conforms_to (dynamic_type (str), class_id.READABLE_STRING_32)
when 3 then
   Result := class_id.readable_string_32_types.has (dynamic_type (str)) -- ARRAY [INTEGER]
when 4 then
   Result := is_type_in_set (dynamic_type (str), class_id.readable_string_32_types) -- THE WINNER

Passes over 500 millisecs (in descending order)

method 4 :  7399.0 times (100%)
method 3 :  4725.0 times (-36.1%)
method 1 :  4272.0 times (-42.3%)
method 2 :  3300.0 times (-55.4%)

5 June 2024

Loop to remove steps until path does not have a parent

path.parent:        43.0 times (100%)
steps.remove_tail:  25.0 times (-41.9%)

13 April 2024

Method for {EL_INTEGER_MATH}.natural_digit_count

Passes over 500 millisecs (in descending order)

quotient := quotient // 10 :  422.0 times (100%)
{DOUBLE_MATH}.log10        :  196.0 times (-53.6%)

13 Dec 2023

Passes over 500 millisecs (in descending order)

C_date: C_DATE; System_time: EL_SYSTEM_TIME

System_time.update:   231.0 times (100%)
C_date.update:         105.0 times (-54.5%)

Directory: benchmark

. /source

. /source/apps

. /source/comparison

. /source/comparison/special-string

. /source/comparison/string

. /source/comparison/structures

. /source/comparison/zstring

. /source/html

. /source/obsolete/string-buffer

. /source/parser

. /source/primes

. /source/string

. /source/string/string_32

. /source/string/zstring

. /source/support

source

APPLICATION_ROOT

Application root

BUILD_INFO

Build specification

Further Information

Click on class link to see notes.

source/apps

BENCHMARK_APP

PRIMES_BENCHMARK_APP

STRING_BENCHMARK_APP

Benchmark shell menu STRING_BENCHMARK_SHELL for string related performance tests

Further Information

Click on class link to see notes.

ZSTRING_BENCHMARK_APP

Command line interface to create and execute ZSTRING_BENCHMARK_COMMAND

source/comparison

ATTACH_TEST_VS_BOOLEAN_COMPARISON

Compare checking if identifier is attached vs checking if boolean is true

BIT_POP_COUNT_COMPARISON

Compare methods to caculate population of 1's in NATURAL_64

BIT_SHIFT_COUNT_COMPARISON

CLASS_ID_ENUM_VS_TYPE_OBJECT

COMPACTABLE_REFLECTIVE_VS_MANUAL_BIT_MASK

DEVELOPER_COMPARISON

Once off comparisons for developer testing

Further Information

Click on class link to see notes.

DIRECTORY_WALK_VS_FIND_COMMAND

Finding files with extension comparison

REFLECTED_REFERENCE_VS_OPTIMIZED_FIELD_RW

ROUTINE_CALL_ON_ONCE_VS_EXPANDED

Compare call on expanded vs once ref object

SYSTEM_TIME_COMPARISON

Click on class link to see notes.

source/comparison/special-string

MAKE_GENERAL_COMPARISON

Compare {L1_UC_STRING}.make_general and {ZSTRING}.make_general

UNICODE_ITEM_COMPARISON

Compare {L1_UC_STRING}.unicode and {ZSTRING}.unicode

source/comparison/string

COMPACT_SUBSTRINGS_32_BUFFERING_COMPARISON

Compact substrings buffering comparison

COMPACT_SUBSTRINGS_32_ITERATION_COMPARISON

Compare EL_COMPACT_SUBSTRINGS_32 iteration methods

IF_ATTACHED_ITEM_VS_CONFORMING_INSTANCE_TABLE

Compare conditional assignment depending on consecutive elseif attachment attempts to two experimental techniques:

  1. STRING_ITERATION_CURSOR_TABLE uses a hash table lookup of type id
  2. STRING_ITERATION_CURSOR_TYPE_MAP uses a linear array search of type id.

Further Information

Click on class link to see notes.

IMMUTABLE_STRING_SPLIT_COMPARISON

Compare iterating immutable VS changeable string list

Further Information

Click on class link to see notes.

LINE_STATE_MACHINE_COMPARISON

Test variations of class CSV_LINE_PARSER

P_I_TH_LOWER_UPPER_VS_INLINE_CODE

REPLACE_SUBSTRING_ALL_VS_GENERAL

Replace substring comparison

STRING_8_SPLIT_VS_SPLIT_ON_CHARACTER_8

Compare parsing comma separated list of reals using across iteration over:

  1. {STRING_8}.split
  2. EL_SPLIT_ON_CHARACTER_8 [READABLE_STRING_8]

Further Information

Click on class link to see notes.

STRING_8_TWIN_VS_SCOPE_COPIED_ITEM

Compare 3 ways to make a temporary copy of STRING_8

Further Information

Click on class link to see notes.

STRING_BENCHMARK_COMPARISON

String benchmark comparison

STRING_CONCATENATION_COMPARISON

Compare various ways of concatenating strings

STRING_CONVERSION_COMPARISON

Compare {READABLE_STRING_GENERAL}.to_integer with {EL_STRING_TO_INTEGER_32}.as_type

Further Information

Click on class link to see notes.

STRING_ITEM_8_VS_ITEM

Compare {STRING_8}.item VS character_32_item

STRING_SPLIT_ITERATION_COMPARISON

String split iteration comparison

Further Information

Click on class link to see notes.

SUBSTRING_INDEX_COMPARISON

Substring index comparison

TOKENIZED_STEPS_VS_XPATH_STRING

source/comparison/structures

ARRAYED_INTERVAL_LIST_COMPARISON

ARRAYED_VS_HASH_SET_SEARCH

ARRAYED_VS_LINKED_LIST

Compare filling LINKED_LIST with filling ARRAYED_LIST

HASH_TABLE_VS_NAMEABLES_LIST_SEARCH

LIST_ITERATION_COMPARISON

Compare 7 ways to iterate over a list

source/comparison/zstring

ZCODEC_AS_Z_CODE

Ways to implement {EL_ZCODEC}.as_zcode

ZSTRING_APPEND_GENERAL_VS_APPEND

ZSTRING_APPEND_Z_CODE_VS_APPEND_CHARACTER

{ZSTRING}.append_z_code VS {ZSTRING}.append_character

ZSTRING_AREA_ITERATION_COMPARISON

ZSTRING_DEVELOPER_COMPARISON

Once off comparisons for developer testing

Further Information

Click on class link to see notes.

ZSTRING_INTERVAL_SEARCH_COMPARISON

ZSTRING_SAME_CHARACTERS_COMPARISON

ZSTRING_SPLIT_COMPARISON

ZSTRING split comparison

Further Information

Click on class link to see notes.

ZSTRING_SPLIT_LIST_COMPARISON

Compare {EL_ZSTRING}.split_list with {EL_ZSTRING_LIST}.make_split

Further Information

Click on class link to see notes.

ZSTRING_TOKENIZATION_COMPARISON

ZSTRING_UNICODE_TO_Z_CODE

Methods to obtain z_code from unicode character

Further Information

Click on class link to see notes.

source/html

BENCHMARK_HTML

Benchmark html

BENCHMARK_TABLE

Benchmark table

MEMORY_BENCHMARK_TABLE

Memory benchmark table

PERFORMANCE_BENCHMARK_TABLE

Performance benchmark table

ZSTRING_BENCHMARK_COMMAND

Zstring benchmark command

source/obsolete/string-buffer

EL_BORROWED_STRING_32_CURSOR

Cursor to use an across loop as an artificial scope in which a temporary STRING_32 buffer can be borrowed from a shared pool. After iterating just once the scope finishes and the buffer item is automatically returned to the shared pool stack.

Further Information

Click on class link to see tests.

EL_BORROWED_STRING_8_CURSOR

Cursor to use an across loop as an artificial scope in which a temporary STRING_8 buffer can be borrowed from a shared pool. After iterating just once the scope finishes and the buffer item is automatically returned to the shared pool stack.

Further Information

Click on class link to see tests.

EL_BORROWED_STRING_CURSOR

Cursor to use an across loop as an artificial scope in which a temporary string buffer conforming to STRING_GENERAL can be borrowed from a shared pool. After iterating just once the scope finishes and the buffer item is automatically returned to the shared pool stack.

Further Information

Click on class link to see notes.

EL_BORROWED_STRING_SCOPE

Defines an across loop scope in which a string conforming to STRING_GENERAL can be borrowed from a factory pool and then automatically returned after the first and only iteration of the cursor.

EL_BORROWED_ZSTRING_CURSOR

Cursor to use an across loop as an artificial scope in which a temporary ZSTRING buffer can be borrowed from a shared pool. After iterating just once the scope finishes and the buffer item is automatically returned to the shared pool stack.

Further Information

Click on class link to see tests.

EL_SHARED_STRING_32_BUFFER_SCOPES

Shared instances of reusable string buffers for type STRING_32 accessible via across loop scope.

Further Information

Click on class link to see notes.

EL_SHARED_STRING_8_BUFFER_SCOPES

Shared instances of reusable string buffers for type STRING_8 accessible via across loop scope.

Further Information

Click on class link to see notes.

EL_SHARED_ZSTRING_BUFFER_SCOPES

Shared instances of reusable string buffers for type ZSTRING accessible via across loop scope.

Further Information

Click on class link to see notes.

EL_STRING_POOL

Map character capacities to reuseable buffer strings. A negative count indicates that the string item is "on loan" as a buffer. A positive count indicates the string is available to borrow.

The borrowed_item routine returns the best match for a preferred capacity.

EL_STRING_POOL_SCOPE

Defines an across loop scope in which multiple strings can be borrowed from a shared pool and automatically returned when the loop exits after first and only iteration

EL_STRING_POOL_SCOPE_CURSOR

Artificial scope defined by an across loop in which strings can be borrowed from a pool See class EL_STRING_POOL_SCOPE

source/parser

CSV_INTEGER_STATE_PARSER

CSV parser for lines encoded as Latin-1

CSV_POINTER_STATE_PARSER

CSV parser for lines encoded as Latin-1

CSV_PROCEDURE_STATE_PARSER

CSV parser using agent states

CSV_STATE_PARSER

CSV parser for lines encoded as Latin-1

FILE_SIZE_SCANNER

Scan Rhythmbox database for total file size

REGULAR_FILE_SIZE_SCANNER

TOKENIZED_FILE_SIZE_SCANNER

source/primes

PRIME_NUMBER_COMMAND

Command to calculate primes using the the sieve of Eratosthenes method

PRIME_NUMBER_SIEVE_1

TO_SPECIAL [BOOLEAN] implementation of PRIME_NUMBER_COMMAND

PRIME_NUMBER_SIEVE_2

MANAGED_POINTER implementation of PRIME_NUMBER_COMMAND

PRIME_NUMBER_SIEVE_3

EL_CPP_BOOLEAN_VECTOR implementation of PRIME_NUMBER_COMMAND

PRIME_NUMBER_SIEVE_4

Implementation using bits compacted into an array of type SPECIAL [NATURAL_32]

source/string

BENCHMARK_CONSTANTS

Benchmark constants

EXTENDED_READABLE_STRING_TABLE

EXTENDED_READABLE_STRING_TYPE_MAP

MIXED_ENCODING_STRING_BENCHMARK

Benchmark using a mix of Latin and Unicode encoded data

STRING_32_ROUTINES

STRING_32 routines for benchmarking

STRING_BENCHMARK

Benchmark using pure Latin encodable string data

STRING_ROUTINES

String routines for benchmarking

TEST_STRINGS

Test strings

ZSTRING_ROUTINES

ZSTRING routines for benchmarking

source/string/string_32

MIXED_ENCODING_STRING_32_BENCHMARK

Benchmark using a mix of Latin and Unicode encoded data

STRING_32_BENCHMARK

Benchmark using pure Latin encodable string data

TEST_STRING_32

Test string 32

source/string/zstring

MIXED_ENCODING_ZSTRING_BENCHMARK

Benchmark using a mix of Latin and Unicode encoded data

TEST_ZSTRING

Test zstring

ZSTRING_BENCHMARK

Benchmark using pure Latin encodable string data

source/support

BENCHMARK_COMMAND_SHELL

Command shell for various kinds of performance comparison benchmarks

COMPACT_SUBSTRINGS_32_C_EXTERNAL

EL_COMPACT_SUBSTRINGS_32_ITERATION that uses inline C for pointer get/set

COMPACT_SUBSTRINGS_32_INDEX

Fast lookup of item in unencoded intervals array by caching area_index

Further Information

Click on class link to see notes.

EXPANDED_ANY

Expanded ANY

NATURAL_32_BIT_ROUTINES_V1

NATURAL_32_BIT_ROUTINES_V2

NATURAL_32_BIT_ROUTINES_V3

STRING_BENCHMARK_SHELL

String related benchmark comparisons

STRING_TUPLE_ASSIGN_SORTER

STRING_TYPE_SORTER

WORD_TOKEN_TABLE