Low efficiency of the mpf_out_str function !
Jan Doornaert
jan.doornaert at programmer.net
Tue Nov 13 20:18:21 CET 2007
Jason,
Have you tried running the program with output NOT to stdout, but to
file?
I don't think the "conversion" from GMP-internal format to decimal takes
*that* much time, but the actual formatted output on-screen (think
"printf") might slow things down (especially for the number of characters
you're outputting)...
CU, JDO
From: "賴 秀琴"
To: gmp-discuss at swox.com
Subject: Low efficiency of the mpf_out_str function !
Date: Wed, 7 Nov 2007 21:39:13 +0800 (CST)
I am a newbie to the GMPand trying to run some example codes ! I find
the result of gmp-chudnovsky.c running strange on my computer. It
shows the efficiency of the mpf_out_str function seems to be very
low. When I try to calculate 800000 digits of pi , the core
calculation take 13.6 sec , but the digits print-out task take more
than 56 sec ( use a stop watch) why ?? Jason Lin the following are
the details------------------- djgpp 2.03
with gmp 4.1.2 (precompiled package)
on a Windows XP command console running with Pentium-4 1.6 GHz / 1G
RAM d:\dp>gcc -Wall -O2 -s -o chud.exe gmp-chudnovsky.c -lm -lgmp
case1:d:\dp>chud 500000 1 <- to get 500000 digits#terms=35256,
depth=17
sieve time = 0.000
...................................................
bs time = 5.110
gcd time = 0.330
div time = 1.099
sqrt time = 0.604
mul time = 0.385
total time = 7.198
P size=727581 digits (1.455162)
Q size=727575 digits (1.455150)
pi(0,35256)=Totally 29 sec to get the final result
(22 sec for the mpf_out_str function ) case2:
d:\dp>chud 800000 1 <- to get 800000 digits
#terms=56410, depth=17
sieve time = 0.000
...................................................
bs time = 10.000
gcd time = 0.495
div time = 1.923
sqrt time = 0.989
mul time = 0.714
total time = 13.626
P size=1164133 digits (1.455166)
Q size=1164127 digits (1.455159)
pi(0,56410)=Totally 69 sec to get the final result
(56 sec for the mpf_out_str function )
---------------------------------------------print out code in
gmp-chudnovsky.c if (out&1) {
printf("pi(0,%ld)=\n", terms);
mpf_out_str(stdout, 10, d+2, qi); <---- it is the hot spot
printf("\n");
___________________________________________________________________
體驗全新Yahoo!奇摩電子信箱2.0 - 馬上體驗!
_______________________________________________
gmp-discuss mailing list
gmp-discuss at swox.com
https://gmplib.org/mailman/listinfo/gmp-discuss
--
Want an e-mail address like mine?
Get a free e-mail account today at www.mail.com!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gmplib.org/list-archives/gmp-discuss/attachments/20071113/2cd10c99/attachment.html
More information about the gmp-discuss
mailing list