Is this make sence? Dynamic assembler for python

2010-06-19 Thread DivX
I found on the forum some discussion about crypting text and one guy
did make assembly implementation of crypting algorithm. He dynamically
generates mashine code and call that from python. Here are impressive
results http://www.daniweb.com/code/snippet216632-5.html

Is this better approach then writing extensions in c?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is this make sence? Dynamic assembler for python

2010-06-19 Thread DivX
On 19 lip, 21:18, geremy condra  wrote:
> On Sat, Jun 19, 2010 at 11:53 AM, DivX  wrote:
> > I found on the forum some discussion about crypting text and one guy
> > did make assembly implementation of crypting algorithm. He dynamically
> > generates mashine code and call that from python. Here are impressive
> > resultshttp://www.daniweb.com/code/snippet216632-5.html
>
> > Is this better approach then writing extensions in c?
>
> No, xor cipher is not suitable for general purpose encryption, and what do you
> need the speed for? xor is almost certainly not going to be the bottleneck in
> your application.
>
> Geremy Condra

Just asking if this approach is good for example quicksort algoriths
or some kind of sorting algorithms, or simulations but the point is of
mixing python and assembler?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is this make sence? Dynamic assembler for python

2010-06-20 Thread DivX
On 20 lip, 02:52, Steven D'Aprano  wrote:
> On Sat, 19 Jun 2010 13:36:57 -0700, DivX wrote:
> > On 19 lip, 21:18, geremy condra  wrote:
> >> On Sat, Jun 19, 2010 at 11:53 AM, DivX  wrote:
> >> > I found on the forum some discussion about crypting text and one guy
> >> > did make assembly implementation of crypting algorithm. He
> >> > dynamically generates mashine code and call that from python. Here
> >> > are impressive
> >> > resultshttp://www.daniweb.com/code/snippet216632-5.html
>
> >> > Is this better approach then writing extensions in c?
>
> >> No, xor cipher is not suitable for general purpose encryption, and what
> >> do you need the speed for? xor is almost certainly not going to be the
> >> bottleneck in your application.
>
> >> Geremy Condra
>
> > Just asking if this approach is good for example quicksort algoriths or
> > some kind of sorting algorithms, or simulations but the point is of
> > mixing python and assembler?
>
> Ask yourself, why aren't programs written in assembly if it's so good?
>
> (1) It's platform dependent. Do you really need a separate program for
> every single hardware platform you want to run Quicksort on?
>
> (2) Writing assembler is hard, really hard. And even harder to debug.
>
> (3) Modern C compilers can produce better (faster, more efficient)
> machine code than the best assembly code written by hand.
>
> Honestly, this question has been resolved twenty years ago -- thirty
> years ago, maybe there was still a good point in writing general purpose
> code in assembly, but now? It's just showing off. Unless you're writing
> hardware specific code (e.g. device drivers) it is pointless, in my
> opinion.
>
> I think that mixing assembly and python is a gimmick of very little
> practical significance. If you really need the extra performance, check
> out PyPy, Cython, Pyrex and Psyco.
>
> --
> Steven

I can agree with you about most of the arguments, but why he continues
to developing it. What he sees and we do not see?
If you're interested I found a link http://www.tahir007.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is this make sence? Dynamic assembler for python

2010-06-20 Thread DivX
On 20 lip, 12:46, Steven D'Aprano  wrote:
> On Sun, 20 Jun 2010 03:19:48 -0700, DivX wrote:
> > On 20 lip, 02:52, Steven D'Aprano  > cybersource.com.au> wrote:
> [...]
> >> I think that mixing assembly and python is a gimmick of very little
> >> practical significance. If you really need the extra performance, check
> >> out PyPy, Cython, Pyrex and Psyco.
>
> >> --
> >> Steven
>
> > I can agree with you about most of the arguments, but why he continues
> > to developing it. What he sees and we do not see?
>
> Why ask us? You should ask him.
>
> --
> Steven

Be sure I will ask him, but before, I wanted to know your opinions
about it. Hear arguments on both sides...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is this make sence? Dynamic assembler for python

2010-06-21 Thread DivX
On 20 lip, 12:57, DivX  wrote:
> On 20 lip, 12:46, Steven D'Aprano 
>
>
>
>
> cybersource.com.au> wrote:
> > On Sun, 20 Jun 2010 03:19:48 -0700, DivX wrote:
> > > On 20 lip, 02:52, Steven D'Aprano  > > cybersource.com.au> wrote:
> > [...]
> > >> I think that mixing assembly and python is a gimmick of very little
> > >> practical significance. If you really need the extra performance, check
> > >> out PyPy, Cython, Pyrex and Psyco.
>
> > >> --
> > >> Steven
>
> > > I can agree with you about most of the arguments, but why he continues
> > > to developing it. What he sees and we do not see?
>
> > Why ask us? You should ask him.
>
> > --
> > Steven
>
> Be sure I will ask him, but before, I wanted to know your opinions
> about it. Hear arguments on both sides...

Where I wrote that he was my friend? But that is not the point, I send
him a mail and here is answer:

"I know that writing assembly code is hard but when you want some
simple algorithm like algorithms in image processing or in digital
signal processing you must write functions in C and then write wrapper
to call that from python because it’s slow to do all work from python.
And then if you want to support windows and Linux you will spend more
time about compiling and see if everything works correctly than on
algorithms.

Another thing is that when you have assembler now you can write some
small C compiler so that you don’t have to write assembly language.
It’s doesn’t matter if gcc will produce better code it’s enough to
achieve speed that you are satisfied  and you don’t have to worry
about how to write extensions for Python.

Also many people use intrinsic functions to achieve more speed when
they need. I think programming using intrinsic functions is like using
sse instructions directly.

Best regards,

Tahir"

So, thanks people for your opinions and arguments...
-- 
http://mail.python.org/mailman/listinfo/python-list