Peter Otten wrote:
>
> # Norvitz/Lundh
> def writelines_data(out, data, map=map, str=str):
> SPACE_JOIN = ' '.join
> out.writelines(
> "ELEMENT %06d %s\n" % (i1, SPACE_JOIN(map(str, i2)))
>for i0, i1, i2 in data if i0 == 'ELEMENT'
> )
>
> def print_data
Chris wrote:
> So my question is how can I speed up what's happening inside the
> function write_data()? Only allowed to use vanilla python (no psycho or
> other libraries outside of a vanilla python install).
> def write_data1(out, data):
> for i in data:
> if i[0] is 'ELEMENT':
>
[EMAIL PROTECTED] wrote:
> Generally, don't create objects, don't perform repeated operations. In
> this case, batch up I/O.
>
>> def write_data1(out, data):
>> for i in data:
>> if i[0] is 'ELEMENT':
>> out.write("%s %06d " % (i[0], i[1]))
>> for j in i[2
Chris wrote:
> This is just some dummy code to mimic what's being done in the real
> code. The actual code is python which is used as a scripting language in
> a third party app. The data structure returned by the app is more or
> less like the "data" list in the code below. The test for "ELEMENT"
Gabriel Genellina wrote:
> At Saturday 18/11/2006 05:09, John Machin wrote:
>
> > > If you can assume that all items have 6 numbers, it appears best to
> > > unroll the inner iteration.
> >
> >Is this meant to be some kind of joke?
> >If so, you should have festooned it with smilies.
> >If not, pl
Just to show how much a system set up
impacts these results:
Result from suse10.1 64 , python 2.4
with AMD FX-55 cpu and about 12 active apps
running in the background. 7200rpm sata drives.
Preparing data...
[write_data1] Preparing output file...
[write_data1] Writing...
[write_data1] Done in 5.4
At Saturday 18/11/2006 05:09, John Machin wrote:
> If you can assume that all items have 6 numbers, it appears best to
> unroll the inner iteration.
Is this meant to be some kind of joke?
If so, you should have festooned it with smilies.
If not, please proceed straight to http://www.thedailyWTF
On Nov 18, 4:23 pm, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
> If you can assume that all items have 6 numbers, it appears best to
> unroll the inner iteration.
Is this meant to be some kind of joke?
If so, you should have festooned it with smilies.
If not, please proceed straight to http:/
On Nov 18, 2:05 pm, Chris <[EMAIL PROTECTED]> wrote:
> with this function I went from 8.04 s to 6.61 s.
And your code became less understandable.
> Now running up against
> my limited knowledge of python. Any chance of getting faster?
You have saved 1.4 *seconds*. What is the normal running ti
Chris wrote:
> I have a vested interest in showing a colleague that a python app can
> yield results in a time comparable to his C-app, which he feels is mch
> faster. I'd like to know what I can do within the constraints of the
> python language to get the best speed possible. Hope someone can he
Chris wrote:
> This is just some dummy code to mimic what's being done in the real
> code. The actual code is python which is used as a scripting language in
> a third party app. The data structure returned by the app is more or
> less like the "data" list in the code below. The test for "ELEMEN
At Friday 17/11/2006 23:40, Chris wrote:
This is just some dummy code to mimic what's being done in the real
code. The actual code is python which is used as a scripting language in
a third party app. The data structure returned by the app is more or
less like the "data" list in the code below.
Hi, Chris.
I made a trivial testing framework for this cute problem and tried a
couple of modifications. I also added the 10% of non-ELEMENT lines you
mentioned. First thing, your updated algorithm didn't really get me much
faster results than the original. I guess that my disk array sort
Chris wrote:
> This is just some dummy code to mimic what's being done in the real
> code. The actual code is python which is used as a scripting language in
> a third party app. The data structure returned by the app is more or
> less like the "data" list in the code below. The test for "ELEMEN
"Chris" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> def write_data1(out, data):
> for i in data:
> if i[0] is 'ELEMENT':
Testing for equality with 'is' is a bit of a cheat since it is
implementation dependent,
but since you have a somewhat unfair constraint
>
This is just some dummy code to mimic what's being done in the real
code. The actual code is python which is used as a scripting language in
a third party app. The data structure returned by the app is more or
less like the "data" list in the code below. The test for "ELEMENT" is
necessary ...
16 matches
Mail list logo