Re: Several Perl Questions - Nov. 5, 2013

Discussion in 'Perl Misc' started by Charlton Wilbur, Nov 5, 2013.

  1. >>>>> "EDG" == E D G <> writes:

    EDG> Are there modules for any Perl versions that enable Perl
    EDG> to do faster calculations?

    No. Perl does calculations as quickly as it can.

    EDG> At the present time the standard math and "use
    EDG> Math::Trig" options are being used. And I am running into
    EDG> problems with how long it can take Perl to do large numbers of
    EDG> relatively simple calculations.

    EDG> If there isn't a faster way to do things then the plan is
    EDG> to have my Perl programs call external programs such as a Basic
    EDG> or Fortran programs, have them do the calculations and then
    EDG> store the results in a file that the Perl program will read.

    This is almost certainly ass-backwards; even without seeing your code,
    I'd wager that your problem is not the speed of individual calculations
    but a poor choice of algorithm and a wasteful use of resources.

    EDG> What is the best way to go with graphics so that png
    EDG> files can be generated by a CGI program and stored on the Web
    EDG> site for display.

    "Best" depends on what constraints you have and what you consider most
    important. The best way for you to go with graphics, is, in my
    professional opinion, to hire a competent programmer with experience
    building web software and leave it to him or her.

    Charlton



    --
    Charlton Wilbur
    Charlton Wilbur, Nov 5, 2013
    #1
    1. Advertising

  2. On 2013-11-05 17:42, Ben Morrow <> wrote:
    > Quoth Charlton Wilbur <>:
    >> >>>>> "EDG" == E D G <> writes:

    >>
    >> EDG> Are there modules for any Perl versions that enable Perl
    >> EDG> to do faster calculations?

    > [reordered...]
    >> EDG> At the present time the standard math and "use
    >> EDG> Math::Trig" options are being used. And I am running into
    >> EDG> problems with how long it can take Perl to do large numbers of
    >> EDG> relatively simple calculations.
    >>
    >> No. Perl does calculations as quickly as it can.

    >
    > This is not true. Perl's core numerical ops are written to preserve
    > accuracy rather than for speed,


    Which is almost certainly irrelevant. The numerical op itself is a
    single CPU (FPU) instruction and that's always done in extended
    precision on x86. (Unless the compiler uses SSE instructions or
    something similar, but AIUI that's only worthwhile if you are using many
    instructions).

    > and any significant calculation will have to run round the Perl op
    > loop many times, which is also rather slow.


    Much, much slower than any math operation built into the CPU. The perl
    interpreter overhead is rather large and unfortunately there seems to be
    no one who works on speeding it up.


    > Math::Trig (and Math::Complex) are pure-Perl OO-based
    > implementations; I would expect these to be even slower.


    What's object oriented about Math::Trig? That seems to me a rather
    simple collection of convenience functions.


    > C-based math is always going to be faster, especially when you're doing
    > a lot of it. There are a lot of Perl bindings to existing fast math
    > libraries; see for instance PDL, Math::GSL, Math::Cephes, Math::pari,
    > Math::GMP*, and so on.


    Yes.

    hp


    --
    _ | Peter J. Holzer | Fluch der elektronischen Textverarbeitung:
    |_|_) | | Man feilt solange an seinen Text um, bis
    | | | | die Satzbestandteile des Satzes nicht mehr
    __/ | http://www.hjp.at/ | zusammenpaƟt. -- Ralph Babel
    Peter J. Holzer, Nov 5, 2013
    #2
    1. Advertising

  3. On 2013-11-05 15:15, Henry Law <> wrote:
    > On 05/11/13 14:53, Charlton Wilbur wrote:
    >> The best way for you to go with graphics, is, in my
    >> professional opinion, to hire a competent programmer with experience
    >> building web software and leave it to him or her.

    >
    > Quite so; but quoth EDG in his original post ...
    >> There are a number of computer programmers who are involved with what
    >> is being discussed here.


    We've all known EDG's claims for years.

    hp


    --
    _ | Peter J. Holzer | Fluch der elektronischen Textverarbeitung:
    |_|_) | | Man feilt solange an seinen Text um, bis
    | | | | die Satzbestandteile des Satzes nicht mehr
    __/ | http://www.hjp.at/ | zusammenpaƟt. -- Ralph Babel
    Peter J. Holzer, Nov 5, 2013
    #3
  4. >>>>> "HL" == Henry Law <> writes:

    HL> On 05/11/13 14:53, Charlton Wilbur wrote:
    >> The best way for you to go with graphics, is, in my professional
    >> opinion, to hire a competent programmer with experience building
    >> web software and leave it to him or her.


    HL> Quite so; but quoth EDG in his original post ...
    >> There are a number of computer programmers who are involved with
    >> what is being discussed here.


    Indeed, and I did not miss that; however, there is one critical
    adjective and an adjectival prhase of lesser of import in my
    recommendation that are nowhere to be found in EDG's statement.

    Charlton

    --
    Charlton Wilbur
    Charlton Wilbur, Nov 11, 2013
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Black

    Re: Several Perl Questions - Nov. 5, 2013

    John Black, Nov 5, 2013, in forum: Perl Misc
    Replies:
    0
    Views:
    106
    John Black
    Nov 5, 2013
  2. Peter J. Holzer

    Re: Several Perl Questions - Nov. 5, 2013

    Peter J. Holzer, Nov 5, 2013, in forum: Perl Misc
    Replies:
    3
    Views:
    123
    Peter J. Holzer
    Nov 7, 2013
  3. Peter J. Holzer

    Re: Several Perl Questions - Nov. 5, 2013

    Peter J. Holzer, Nov 5, 2013, in forum: Perl Misc
    Replies:
    0
    Views:
    106
    Peter J. Holzer
    Nov 5, 2013
  4. Tim McDaniel

    Re: Several Perl Questions - Nov. 5, 2013

    Tim McDaniel, Nov 5, 2013, in forum: Perl Misc
    Replies:
    0
    Views:
    139
    Tim McDaniel
    Nov 5, 2013
  5. Justin C
    Replies:
    0
    Views:
    94
    Justin C
    Nov 6, 2013
Loading...

Share This Page