You can try opening the file with a larger bufsize parameter, or you could
print to a StringIO instead and then write the data all at once.
On Wed, Oct 15, 2008 at 11:12 AM, Horvátth Szabolcs
<[EMAIL PROTECTED]>wrote:
>
> Hi,
>
> I'm doing some data exporting using a python scripted plugin command and
> found the file output being very slow.
> In a specific case the file write took 90 seconds and when I commented
> the f.write() stuff (so the command only did the queries) it dropped to
> 15 seconds.
> This is the structure of the write part:
>
> for i in range(numberOfHairs):
> ...
> for j in range (numberOfPoints):
> ...
> f.write("\t\t%.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f
> %.3f\n" % (A[j][0], A[j][1], A[j][2], B[j][0]-A[j][0], B[j][1]-A[j][1],
> B[j][2]-A[j][2], C[j], D[j][0], D[j][1], D[j][2]))
> f.close()
>
> Am I doing completely wrong? What can I do to speed up ascii file writing?
>
> Cheers,
> Szabolcs
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
Yours,
Maya-Python Club Team.
-~----------~----~----~----~------~----~------~--~---