This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: long long performance


At 2:02 PM -0800 12/13/00, Rob Willis wrote:
>Thanks for the info.  Assuming the longlong multiply isnt too much more
>complex, it still does not explain the 13x slower performance over that
>of just a normal long mulitply.  The timing on my P3/600 gave the
>following (i've already subtracted out the overhead for the loop and
>variable assignment):
>
>All times are for 1 billion operations to complete.
>
>long long mult:  33 secs
>long mult:       2.4 secs


	Unless I'm missing something if you double the number of
	bits you are multiplying, you have 4x as many multiplies to
	do; e.g.

			ab x cd => ac + ad + bc + bd  (with appropriate
							shifting of the
							addends)


	add to that the overhead of adding the pieces and the
	general lameness of the x86 architecture and it's probably
	pretty easy to end up nearly 16 times slower.

	Plus, with the x86, your long variables could live in
	registers, while 'long long' will be on the stack, and
	by this point, I think you should be happy that it's only
	14 times slower :-)

	If you want fast 64 bit integers, try a PowerPC or even
	better, an Alpha.

-- Al
-- 
------------------------------------------------------------------------

		    Quality Software Management
		http://www.tiac.net/users/qsmgmt
			apl@alum.mit.edu
			(978)287-0435 Voice
			(978)808-6836 Cell
			(978)287-0436 Fax

	Software Process Improvement and Management Consulting
	     Language Design and Compiler Implementation

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]