Giter Club home page Giter Club logo

Comments (14)

ShedskinBot avatar ShedskinBot commented on June 2, 2024

Comment by Mark Dufour
16 Jun 2009 at 7:49 GMT


thanks for reporting!

the x86_64 specific issue is fixed in SVN (some old types are no longer 
supported in
newer versions of GCC):

http://code.google.com/p/shedskin/source/detail?r=751

the other issue is caused by a missing cast (tuple<void *..> should be cast to
tuple<int..> here).. I will look into that. in the meantime, if you'd like to 
compile
the code anyway, you can just change 'void *' with 'int'. 
  • Changed state: Accepted

from shedskin.

ShedskinBot avatar ShedskinBot commented on June 2, 2024

Comment by [email protected]
17 Jun 2009 at 6:26 GMT


Thank you :)

Now it's fully working for me. Actually, it's 3.3 time faster, good :)
And with another program that I've wrote, it's 10 time faster :D

Thank you for your work ;)

from shedskin.

ShedskinBot avatar ShedskinBot commented on June 2, 2024

Comment by Mark Dufour
17 Jun 2009 at 7:20 GMT


thanks for the feedback!!

I had a quick look at the problem, and apparently I forgot to add casts for 
yield
statements. so that should be easy to fix.. 


from shedskin.

ShedskinBot avatar ShedskinBot commented on June 2, 2024

Comment by Mark Dufour
18 Jun 2009 at 10:22 GMT


okay, I updated SVN with a fix for this.. thanks again for reporting, and 
please let
me know if you run into anything else.


  • Changed state: Fixed

from shedskin.

ShedskinBot avatar ShedskinBot commented on June 2, 2024

Comment by Mark Dufour
21 Jun 2009 at 9:13 GMT


btw, if you replace this:

for a,b in enumerate(c):

with this:

for a in range(len(c)):
    b = c[a]

you will get a large speedup. this is because with enumerate, you are implicitly
generating lots of tuple objects, which slows down C++ a lot.

also, you might want to use shedskin -bw for a secondary speedup (but note your 
code
for parsing arguments won't raise an IndexError anymore now, but this is easy 
to work
around).

from shedskin.

ShedskinBot avatar ShedskinBot commented on June 2, 2024

Comment by Mark Dufour
21 Jun 2009 at 11:00 GMT


after profiling life_shed.cpp a bit, I decided to optimize list slicing 
(something I
should have done ages ago). this makes the program a bit faster still.. now it's
about 30 times faster here (after replacing the enumerate statements). if you'd 
be
interested in trying, please pull from SVN.

from shedskin.

ShedskinBot avatar ShedskinBot commented on June 2, 2024

Comment by [email protected]
22 Jun 2009 at 8:32 GMT


Woow! It's so fast! It's 10 times faster of the last shed_skin version, so 
about 30
times faster of the original version. Thanks :)

from shedskin.

ShedskinBot avatar ShedskinBot commented on June 2, 2024

Comment by Mark Dufour
22 Jun 2009 at 7:49 GMT


I could also have a look at the other program you mentioned, if you like? 

btw, I'm working on a fix so that 'for a,b in enumerate(some_sequence)' will 
become
as fast as manually replacing it.. thanks for reminding me of this useful 
optimization.

from shedskin.

ShedskinBot avatar ShedskinBot commented on June 2, 2024

Comment by [email protected]
22 Jun 2009 at 9:13 GMT


Sure ;) This is only a class with a little test, nothing more.
I thinked: it could be possible to use shed for qt programs? c and python use 
the
same methods for qt :)

Attachments:

from shedskin.

ShedskinBot avatar ShedskinBot commented on June 2, 2024

Comment by Mark Dufour
23 Jun 2009 at 9:06 GMT


some tips for better performance:

-use sets for 'in' checks and 'index'. for lists, these imply walking over the 
list
every time (which isn't faster in C++), while for sets, this takes only 
constant time
(one step).

-shedskin -r boosts performance a bit more (shedskin now uses C random numbers
instead of Python compatible ones)

-there is still one problematic line: del self.uids[self.uids.index(uid)]. 
because of
index, but also because 'del' on a list means shifting on average half of the 
list.
you might be able to find a faster solution usings sets or possible a linked 
list, so
half the list doesn't have to be shifted each time.

see attachment for a slightly modified version.

note that you really don't want to compile qt code. because a) interface glue 
won't
get any faster, and b) this would restrict your code too much. a better 
solution is
to compile an extension module (shedskin -e, see the tutorial), and import this 
in
some 'main' program that uses Qt.



Attachments:

from shedskin.

ShedskinBot avatar ShedskinBot commented on June 2, 2024

Comment by [email protected]
23 Jun 2009 at 5:47 GMT


Thanks so much, I'll try the extension module approach.

from shedskin.

ShedskinBot avatar ShedskinBot commented on June 2, 2024

Comment by [email protected]
23 Jun 2009 at 6:39 GMT


I've changed a bit the test part, when it tries to remove some random items. So 
I can
use only sets. The performance of this python file are shown here:

[frafra@rocketman idee]$ time python idee_shed.py
[...]
real    0m3.777s
user    0m3.676s
sys 0m0.064s
[frafra@rocketman idee]$ ../../shedskin -r idee_shed.py
[...]
[frafra@rocketman idee]$ time ./idee_shed
[...]
real    0m0.209s
user    0m0.162s
sys 0m0.042s

So, about 18 times faster :)
Yes, the test code makes the performances a bit more different for every run, 
but it
doesn't matter :)

Attachments:

from shedskin.

ShedskinBot avatar ShedskinBot commented on June 2, 2024

Comment by Mark Dufour
25 Jun 2009 at 5:43 GMT


I finally sat down and optimized the following in SVN:

.. for var, .. in enumerate(some list/tuple) ..

so the hack with 'for .. in range(len(..))' is not necessary anymore for 
life_shed.

I'm hoping to do something similar for 'zip', before the next release:

.. for .., .. in zip(list/tuple args) ..

both patterns are quite common, so I should have done this a long time ago..

btw, did you try to build an extension module yet?

from shedskin.

ShedskinBot avatar ShedskinBot commented on June 2, 2024

Comment by [email protected]
25 Jun 2009 at 8:48 GMT


Actually I'm doing an important exam, please excuse me :) I'll try as soon as I 
can ;)

from shedskin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.