I would split the f.write line into two: one to query the data and do
the format to a string, and the second one to f.write the string.
Commenting out first and second would give the idea of which one to
blame for slowing down.
On Wed, Oct 15, 2008 at 8: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
>
>
>
> >
>
--
Alex "Sasha" Segal
[EMAIL PROTECTED]
http://www.alexsegal.net
--~--~---------~--~----~------------~-------~--~----~
Yours,
Maya-Python Club Team.
-~----------~----~----~----~------~----~------~--~---