<div>
<span id="obmessage">Jason,<br><br>Have you tried running the program with output NOT to stdout, but to file?<br>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)...<br><br>CU, JDO<br></span>
<blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;">From: "賴 秀琴" <chyn0610@yahoo.com.tw><br>
To: gmp-discuss@swox.com<br>
Subject: Low efficiency of the mpf_out_str function !<br>
Date: Wed, 7 Nov 2007 21:39:13 +0800 (CST)<br>
<br>
</chyn0610@yahoo.com.tw><div>I am a newbie to the GMP</div> <div>and trying to run some example codes !</div> <div> </div> <div>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)</div> <div> </div> <div>why ??</div> <div> </div> <div>Jason Lin</div> <div> </div> <div>the following are the details</div> <div>-------------------</div> <div> </div> <div>djgpp 2.03<br>with gmp 4.1.2 (precompiled package)<br>on a Windows XP command console running with Pentium-4 1.6 GHz / 1G RAM</div> <div> </div> <div>d:\dp>gcc -Wall -O2 -s -o chud.exe gmp-chudnovsky.c -lm -lgmp</div> <div> </div> <div>case1:</div> <div>d:\dp>chud 500000 1 <- to get
500000 digits</div> <div>#terms=35256, depth=17<br>sieve time = 0.000<br>...................................................<br>bs time = 5.110<br> gcd time = 0.330<br>div time = 1.099<br>sqrt time = 0.604<br>mul time = 0.385<br>total time = 7.198<br> P size=727581 digits (1.455162)<br> Q size=727575 digits (1.455150)<br>pi(0,35256)=</div> <div>Totally 29 sec to get the final result<br>(22 sec for the mpf_out_str function )</div> <div> </div> <div> </div> <div>case2:<br>d:\dp>chud 800000 1 <- to get 800000 digits<br>#terms=56410, depth=17<br>sieve time = 0.000<br>...................................................<br>bs time = 10.000<br> gcd time =
0.495<br>div time = 1.923<br>sqrt time = 0.989<br>mul time = 0.714<br>total time = 13.626<br> P size=1164133 digits (1.455166)<br> Q size=1164127 digits (1.455159)<br>pi(0,56410)=</div> <div>Totally 69 sec to get the final result<br>(56 sec for the mpf_out_str function )</div> <div> </div> <div>---------------------------------------------</div> <div>print out code in gmp-chudnovsky.c</div> <div> </div> <div>if (out&1) {<br> printf("pi(0,%ld)=\n", terms);<br> mpf_out_str(stdout, 10, d+2, qi); <---- it is the hot spot<br> printf("\n");</div><p>
___________________________________________________________________<br>
體驗全新Yahoo!奇摩電子信箱2.0 - <a href="http://tw.rd.yahoo.com/referurl/mail/mail20/tag_1022/*http://tw.mg0.mail.yahoo.com/dc/landing"><strong>馬上體驗</strong></a>!
<br>
_______________________________________________<br>
gmp-discuss mailing list<br>
gmp-discuss@swox.com<br>
https://gmplib.org/mailman/listinfo/gmp-discuss<br>
</p></blockquote>
</div>
<BR>
--
<div> Want an e-mail address like mine? </b><br>
Get a <b>free e-mail </b>account today at <a href="http://www.mail.com/Product.aspx" target="_blank">www.mail.com</a>!</div>