I'm going to write a modified version of MakeGraph by mike3
#8
(02/23/2023, 04:30 PM)JmsNxn Wrote: E =
For X = 0, 500:
      For Y=0, 500:
           WRITE(X,Y)

(...)
Mike3's time would be written:

MIKE =
For X=0,500:
    For Y=0, 500:
          P = F(X,Y);
          WRITE(P);

(...)

Hmm, I cannot go deep into it. But when I optimized Mike3's procedure my first rewriting was to replace the "write(element)" by something like "write(vector-of-elements)" because the Pari/GP-internal implementation of the elementwise "write()" is extremely time-consumptive. So for instance it would be better to put the elements using "Str()" into a string-variable, and then you can with one (of this time-consumptive) "write()" deliver the whole line to the file. You might even construct the file-image as complete string including the "\n"-linefeeds and deliver this with one "write()"-call at all.

In the new versions of Pari/GP there is moreover a low-level "filewrite()" which has a cache in the background and performs much faster than all procedures which call "write()" in a loop.

Something more perhaps ... but have not much time at the moment...
Gottfried Helms, Kassel
Reply


Messages In This Thread
RE: I'm going to write a modified version of MakeGraph by mike3 - by Gottfried - 02/23/2023, 05:08 PM



Users browsing this thread: 3 Guest(s)