From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!weretis.net!feeder2.news.weretis.net!feeder.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Colin Paul Gloster Newsgroups: comp.lang.ada Subject: Re: Is there an Ada compiler whose Ada.Numerics.Generic_Elementary_Functions.Log(Base=>10, X=>variable) is efficient? Date: Mon, 15 Feb 2010 14:17:19 +0000 Organization: A noiseless patient Spider Message-ID: References: Reply-To: Colin Paul Gloster Mime-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII Injection-Date: Mon, 15 Feb 2010 14:19:34 +0000 (UTC) Injection-Info: feeder.eternal-september.org; posting-host="kheEuXGHhE2Z5eF1gAST+A"; logging-data="9218"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18pcWGnxggQRybbwDH5wzE21besGmDp7LiUs0K8c6Sj4g==" User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) In-Reply-To: Cancel-Lock: sha1:rF8CrV45lEe56PaQI2Hpg7frEiI= X-X-Sender: Colin_Paul@Bluewhite64.example.net Xref: g2news1.google.com comp.lang.ada:9232 Date: 2010-02-15T14:17:19+00:00 List-Id: On Mon, 15 Feb 2010, John B. Matthews wrote: |--------------------------------------------------------------------| |"In article | |, | | Colin Paul Gloster wrote: | | | |> gnatmake -O3 logarithmic_work_in_Ada.adb -o | |> logarithmic_work_in_Ada_compiled_by_GNAT | |> | |> time ./logarithmic_work_in_Ada_compiled_by_GNAT | |> 6.34086408536266E+08 | |> | |> real 1m33.338s | |> user 1m33.338s | |> sys 0m0.000s | | | |I get a different answer: 698970 = 1000000 * (log10(50) - 1). | | | |$ make clean logada ; time ./logada | |rm -f *.o *.ali b~* core logada | |gnatmake logada -cargs -O3 -gnatwa -bargs -shared -largs -dead_strip| |gcc -c -O3 -gnatwa logada.adb | |gnatbind -shared -x logada.ali | |gnatlink logada.ali -shared-libgcc -dead_strip | | 6.98970004334243E+05 | | | |real 0m0.138s | |user 0m0.136s | |sys 0m0.002s | | | |-- | |John B. Matthews | |trashgod at gmail dot com | | " | |--------------------------------------------------------------------| Hi, Thanks for running it. The Ada program for timing had 500 statements in the body of the loop. I reproduced only the first and last verbatim: I showed a bash (Bourne Again SHell) line for producing all 500 statements in a comment in-between the the first statement and the last statement. You ran a program with 498 of the statements missing. Anyway, the answer produced by the program is not so much of concern as the relative speeds of different implementations. Did g++ produce a faster result for you than GNAT? It did for me for many versions of GCC today on a different platform than I used in the beginning of this thread... g++ -O3 -ffast-math logarithmic_work_in_CPlusPlus.cc -o logarithmic_work_in_CPlusPlus_compiled_by_64bit_GCC4.4.3_with_-ffast-math time ./logarithmic_work_in_CPlusPlus_compiled_by_64bit_GCC4.4.3_with_-ffast-math 6.34086e+08 real 0m0.012s user 0m0.008s sys 0m0.004s g++ -O3 -ffast-math logarithmic_work_in_CPlusPlus.cc -o logarithmic_work_in_CPlusPlus_compiled_by_64bit_GCC4.3.2_with_-ffast-math time ./logarithmic_work_in_CPlusPlus_compiled_by_64bit_GCC4.3.2_with_-ffast-math 6.34086e+08 real 0m0.012s user 0m0.012s sys 0m0.000s g++ -O3 logarithmic_work_in_CPlusPlus.cc -o logarithmic_work_in_CPlusPlus_compiled_by_64bit_GCC4.3.2 time ./logarithmic_work_in_CPlusPlus_compiled_by_64bit_GCC4.3.2 6.34086e+08 real 0m0.567s user 0m0.560s sys 0m0.000s g++ -O3 logarithmic_work_in_CPlusPlus.cc -o logarithmic_work_in_CPlusPlus_compiled_by_64bit_GCC4.4.3 time ./logarithmic_work_in_CPlusPlus_compiled_by_64bit_GCC4.4.3 6.34086e+08 real 0m0.566s user 0m0.564s sys 0m0.004s g++ -O3 logarithmic_work_in_CPlusPlus.cc -o logarithmic_work_in_CPlusPlus_compiled_by_64bit_GCC4.3.3 time ./logarithmic_work_in_CPlusPlus_compiled_by_64bit_GCC4.3.3 6.34086e+08 real 0m0.583s user 0m0.572s sys 0m0.004s gnatmake -O3 -ffast-math Logarithmic_Work_In_Ada.adb -o Logarithmic_Work_In_Ada_compiled_by_64bit_GCC4.4.3_with_-ffast-math time ./Logarithmic_Work_In_Ada_compiled_by_64bit_GCC4.4.3_with_-ffast-math 6.34086408536266E+08 real 0m31.618s user 0m31.618s sys 0m0.000s gnatmake -O3 Logarithmic_Work_In_Ada.adb -o Logarithmic_Work_In_Ada_compiled_by_64bit_GCC4.4.3 time ./Logarithmic_Work_In_Ada_compiled_by_64bit_GCC4.4.3 6.34086408606382E+08 real 0m32.750s user 0m32.746s sys 0m0.004s gnatmake -O3 Logarithmic_Work_In_Ada.adb -o Logarithmic_Work_In_Ada_compiled_by_64bit_GCC4.3.2 time ./Logarithmic_Work_In_Ada_compiled_by_64bit_GCC4.3.2 6.34086408606382E+08 real 0m33.537s user 0m33.506s sys 0m0.004s gnatmake -O3 Logarithmic_Work_In_Ada.adb -o Logarithmic_Work_In_Ada_compiled_by_64bit_GCC4.3.3 time ./Logarithmic_Work_In_Ada_compiled_by_64bit_GCC4.3.3 6.34086408606382E+08 real 0m33.717s user 0m33.718s sys 0m0.000s g++ -O3 logarithmic_work_in_CPlusPlus.cc -o logarithmic_work_in_CPlusPlus_compiled_by_64bit_GCC4.2.4 time ./logarithmic_work_in_CPlusPlus_compiled_by_64bit_GCC4.2.4 6.34086e+08 real 0m34.000s user 0m33.982s sys 0m0.000s gnatmake -O3 Logarithmic_Work_In_Ada.adb -o Logarithmic_Work_In_Ada_compiled_by_64bit_GCC4.2.4 time ./Logarithmic_Work_In_Ada_compiled_by_64bit_GCC4.2.4 6.34086408606382E+08 real 0m34.037s user 0m34.034s sys 0m0.004s gnatmake -O3 -ffast-math Logarithmic_Work_In_Ada.adb -o Logarithmic_Work_In_Ada_compiled_by_64bit_GCC4.3.2_with_-ffast-math time ./Logarithmic_Work_In_Ada_compiled_by_64bit_GCC4.3.2_with_-ffast-math 6.34086408536266E+08 real 0m35.093s user 0m35.090s sys 0m0.004s