Bug #11604 Performance degradation caused by do_div_mod() call
Submitted: 28 Jun 2005 9:29 Modified: 10 Jan 2013 11:00
Reporter: Marko Mäkelä Email Updates:
Status: Won't fix Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.8 OS:Any (all)
Assigned to: Assigned Account CPU Architecture:Any

[28 Jun 2005 9:29] Marko Mäkelä
In the sql-bench test suite, the ATIS benchmark is several percent slower in MySQL/InnoDB 5.0 than in 4.1. One remarkable culprit (found with OProfile's opreport tool) is the function do_div_mod(), which seems to account for half the performance degradation. It seems to be called for the AVG() function, where a fast floating-point division would do.

How to repeat:
cd sql-bench
./test-ATIS (repeat 100 times)

Compare the execution times reported for 4.1 and 5.0.

Suggested fix:
Divide the avg() result later, so that it can be done faster in a floating-point context. Use the new function in a precise arithmetic context only.
[30 Jun 2005 6:37] Aleksey Kishkin
(in order to reproduce it)
what sql bench did you use (from bk or from mysql distributive)? And what mysql settings did you use? 

What hardware and OS did you use?
[30 Jun 2005 9:21] Marko Mäkelä
The test was run for me by Vadim Tkachenko. In Bug #11605, he writes:
"I used default mysqld params (i.e. I ran it as ./mysqld --user=root)
and I used sql-bench from mysql-5.0/sql-bench dir"
[13 Aug 2007 12:35] Marko Mäkelä
This is related to Bug #11605 and Bug #29921.
[28 Feb 2008 18:29] Georgi Kodinov
Bug #16584 marked as a duplicate of this one