[metapost] reading a large array
qiong.cai at gmail.com
Fri Mar 10 01:56:59 CET 2017
Here's the code to read an array of data from a file.
vardef readFromFile(suffix a)(text filename) =
c := 0;
s := readfrom filename;
exitif s = EOF;
a[c] := s;
c := c+1;
The performance of this function on my iMac (3.xGHz, Intel SKL) is shown
10 numbers: 0.096 seconds
1M: after 15 minutes, still not finishing
It seems that from 100K to 1M, it's getting slower every 10K or 1K. I guess
the memory allocator in metapost pre-allocates certain memory and copies
the whole memory when the array increases. Is that the case? If so, could
we improve the memory allocation in metapost?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the metapost