mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-05 18:16:23 +03:00
Function Strtod() is reimplemented using open source (MIT-style license) code by David M. Gay instead of strtod() provided by standard run-time library. This improves its performance by 3-10 times. Functions Atof(), Strtod(), Printf(), Sprintf(), Fprintf() are declared as extern "C" to be usable from C programs. Strtod() is used in Interface_FileReaderData::Fastof() and in RWStl_Reader to accelerate their work. DRAW command QATestAtof and test perf fclasses strtod are added to check correctness and performance of Strtod(). Test perf draw restore is added to monitor performance of reading BREP files. Minor off-topic corrections: - method Standard_GUID::Assign (const Standard_UUID&) is implemented (was empty); - Precision.hxx is included in BRepMesh_Vertex.hxx that uses it.
49 lines
1.7 KiB
Plaintext
49 lines
1.7 KiB
Plaintext
puts "================================================================="
|
|
puts "Testing performance of Strtod() vs. standard strtod()"
|
|
puts "================================================================="
|
|
puts ""
|
|
|
|
pload QAcommands
|
|
|
|
# Check that performance of Strtod() and Atof() is at least twice better
|
|
# than that of standard strtod() and atof()
|
|
proc CheckAtof {nbvalues nbdigits min max} {
|
|
set res [QATestAtof $nbvalues $nbdigits $min $max]
|
|
# puts $res
|
|
|
|
if { ! [regexp {atof\s+([0-9.]+)} $res bidon cpu_atof] ||
|
|
! [regexp {Atof\s+([0-9.]+)} $res bidon cpu_Atof] ||
|
|
! [regexp {strtod\s+([0-9.]+)} $res bidon cpu_strtod] ||
|
|
! [regexp {Strtod\s+([0-9.]+)} $res bidon cpu_Strtod] } {
|
|
puts "Error: cannot interpret results of test command!"
|
|
} else {
|
|
if { $cpu_atof < 2 * $cpu_Atof } {
|
|
puts "Error: Atof() is expected to be at least 2 times better than atof()!"
|
|
}
|
|
if { $cpu_strtod < 2 * $cpu_Strtod } {
|
|
puts "Error: Strtod() is expected to be at least 2 times better than strtod()!"
|
|
}
|
|
}
|
|
}
|
|
|
|
puts "1M random values, 10 significant digits, in range (-1e9, 1e9)"
|
|
CheckAtof 1000000 10 -1e9 1e9
|
|
|
|
puts "1M random values, 10 significant digits, in range (-1e305, 1e305)"
|
|
CheckAtof 1000000 10 -1e305 1e305
|
|
|
|
puts "1M random values, 16 significant digits, in range (-1e9, 1e9)"
|
|
CheckAtof 1000000 16 -1e9 1e9
|
|
|
|
puts "1M random values, 18 significant digits, in range (-1e305, 1e305)"
|
|
CheckAtof 1000000 16 -1e305 1e305
|
|
|
|
# Disarm FPE signals - otherwise they will be raised if signaling NAN appears
|
|
dsetsignal 0
|
|
|
|
puts "Special values + 1M values defined by random binary data, 10 digits"
|
|
CheckAtof 1000000 10 0 0
|
|
|
|
puts "Special values + 1M values defined by random binary data, 16 digits"
|
|
CheckAtof 1000000 16 0 0
|