numeric_performance.qbk 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. [/==============================================================================
  2. Copyright (C) 2001-2011 Joel de Guzman
  3. Copyright (C) 2001-2011 Hartmut Kaiser
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ===============================================================================/]
  7. [section:numeric_performance Performance of Numeric Generators]
  8. [section:int_performance Comparing the performance of a single int_ generator]
  9. These performance measurements are centered around default formatting of a
  10. single `int` integer number using different libraries and methods.
  11. The overall execution times for those examples are compared below. We compare
  12. using `sprintf`, C++ iostreams, __boost_format__, and __karma__.
  13. For the full source code of the performance test please see here:
  14. [@../../workbench/karma/int_generator.cpp int_generator.cpp]. All the
  15. measurements have been done by executing `1e7` iterations for each
  16. formatting type (NUMITERATIONS is set to `1e7` in the code shown below).
  17. [import ../../workbench/karma/int_generator.cpp]
  18. Code used to measure the performance for `ltoa`:
  19. [karma_int_performance_ltoa]
  20. Code used to measure the performance for standard C++ iostreams:
  21. [karma_int_performance_iostreams]
  22. Code used to measure the performance for __boost_format__:
  23. [karma_int_performance_format]
  24. Code used to measure the performance for __karma__ using a plain character buffer:
  25. [karma_int_performance_plain]
  26. The following table shows the overall performance results collected
  27. while using different compilers. All times are in seconds measured for `1e7`
  28. iterations (platform: Windows7, Intel Core Duo(tm) Processor, 2.8GHz, 4GByte RAM).
  29. For a more readable comparison of the results see this
  30. [link spirit.karma.int_performance figure].
  31. [table Performance comparison for a single int (all times in [s], `1e7` iterations)
  32. [[Library] [gcc 4.4.0 (32 bit)] [VC++ 10 (32 bit)] [Intel 11.1 (32 bit)] [gcc 4.4.0 (64 bit)] [VC++ 10 (64 bit)] [Intel 11.1 (64 bit)]]
  33. [[ltoa] [1.542] [0.895] [0.884] [1.163] [1.099] [0.906]]
  34. [[iostreams] [6.548] [13.727] [11.898] [3.464] [8.316] [8.115]]
  35. [[__boost_format__] [16.998] [21.813] [20.477] [17.464] [14.662] [13.646]]
  36. [[__karma__ int_] [1.421] [0.744] [0.697] [1.072] [0.953] [0.606]]
  37. ]
  38. [fig int_performance.png..Performance comparison for a single int..spirit.karma.int_performance]
  39. [endsect]
  40. [/////////////////////////////////////////////////////////////////////////////]
  41. [section:double_performance Comparing the performance of a single double_ generator]
  42. These performance measurements are centered around default formatting of a
  43. single `double` floating point number using different libraries and methods.
  44. The overall execution times for those examples are compared below. We compare
  45. using `sprintf`, C++ iostreams, __boost_format__, and __karma__.
  46. For the full source code of the performance test please see here:
  47. [@../../workbench/karma/double_performance.cpp double_performance.cpp]. All the
  48. measurements have been done by executing `1e6` iterations for each
  49. formatting type (NUMITERATIONS is set to `1e6` in the code shown below).
  50. [import ../../workbench/karma/double_performance.cpp]
  51. Code used to measure the performance for `sprintf`:
  52. [karma_double_performance_printf]
  53. Code used to measure the performance for standard C++ iostreams:
  54. [karma_double_performance_iostreams]
  55. Code used to measure the performance for __boost_format__:
  56. [karma_double_performance_format]
  57. The following code shows the common definitions used by all __karma__ performance
  58. measurements as listed below:
  59. [karma_double_performance_definitions]
  60. Code used to measure the performance for __karma__ using a plain character buffer:
  61. [karma_double_performance_plain]
  62. The following table shows the overall performance results collected
  63. while using different compilers. All times are in seconds measured for `1e6`
  64. iterations (platform: Windows7, Intel Core Duo(tm) Processor, 2.8GHz, 4GByte RAM).
  65. For a more readable comparison of the results see this
  66. [link spirit.karma.double_performance figure].
  67. [table Performance comparison for a single double (all times in [s], `1e6` iterations)
  68. [[Library] [gcc 4.4.0 (32 bit)] [VC++ 10 (32 bit)] [Intel 11.1 (32 bit)] [gcc 4.4.0 (64 bit)] [VC++ 10 (64 bit)] [Intel 11.1 (64 bit)]]
  69. [[sprintf] [0.755] [0.965] [0.880] [0.713] [0.807] [0.694]]
  70. [[iostreams] [2.316] [2.624] [1.964] [1.634] [1.468] [1.354]]
  71. [[__boost_format__] [3.188] [3.737] [2.878] [3.217] [2.672] [2.011]]
  72. [[__karma__ double_] [0.813] [0.561] [0.368] [0.426] [0.260] [0.218]]
  73. ]
  74. [fig double_performance.png..Performance comparison for a single double..spirit.karma.double_performance]
  75. [endsect]
  76. [////////////////////////////////////////////////////////////////////////////]
  77. [section:format_performance Comparing the performance of a sequence of several generators]
  78. These performance measurements are centered around formatting of a sequence of
  79. different items, including 2 `double` floating point numbers using different
  80. libraries and methods. The overall execution times for those examples are
  81. compared below. We compare using `sprintf`, C++ iostreams, __boost_format__,
  82. and __karma__.
  83. For the full source code of the performance test please see here:
  84. [@../../workbench/karma/format_performance.cpp format_performance.cpp]. All the
  85. measurements have been done by doing `1e6` iterations for each formatting
  86. type (NUMITERATIONS is set to `1e6`).
  87. [import ../../workbench/karma/format_performance.cpp]
  88. Code used to measure the performance for sprintf:
  89. [karma_format_performance_printf]
  90. Code used to measure the performance for standard iostreams:
  91. [karma_format_performance_iostreams]
  92. Code used to measure the performance for __boost_format__:
  93. [karma_format_performance_format]
  94. The following code shows the common definitions used by all __karma__
  95. performance measurements as listed below:
  96. [karma_format_performance_definitions]
  97. Code used to measure the performance for __karma__ using a plain character
  98. buffer:
  99. [karma_format_performance_plain]
  100. The following table shows the overall performance results collected
  101. while using different compilers. All times are in seconds measured for `1e6`
  102. iterations (platform: Windows7, Intel Core Duo(tm) Processor, 2.8GHz, 4GByte RAM).
  103. For a more readable comparison of the results see this
  104. [link spirit.karma.format_performance figure].
  105. [table Performance comparison for a sequence of several items (all times in [s], `1e6` iterations)
  106. [[Library] [gcc 4.4.0 (32 bit)] [VC++ 10 (32 bit)] [Intel 11.1 (32 bit)] [gcc 4.4.0 (64 bit)] [VC++ 10 (64 bit)] [Intel 11.1 (64 bit)]]
  107. [[sprintf] [1.725] [1.892] [1.903] [1.469] [1.608] [1.493]]
  108. [[iostreams] [4.827] [5.287] [4.444] [3.112] [3.319] [2.877]]
  109. [[__boost_format__] [5.881] [7.089] [5.801] [5.455] [5.254] [4.164]]
  110. [[__karma__] [1.942] [1.242] [0.999] [1.334] [0.758] [0.686]]
  111. ]
  112. [fig format_performance.png..Performance comparison for a sequence of several items..spirit.karma.format_performance]
  113. [endsect]
  114. [endsect]