Re: How to make this unpickling/sorting demo faster?



On Apr 17, 7:37 pm, Paul Rubin <http://phr...@xxxxxxxxxxxxxx> wrote:

Therefore the likelihood of a C or asm program
being 20x faster including disk i/o is dim.  But realistically,
counting just CPU time, you might get a 20x speedup with assembler if
you're really determined, using x86 SSE (128-bit vector) instructions,
cache prefetching, etc.

I think that the attitude that is prevalent is that although Python
and other "interpreted" languages are slow, there are places where
that slowness is not important and using them is OK. The point that I
am trying to make with my example is that often, by leveraging the
care and optimization work that others have put into the Python
standard library over the years, a rather casual programmer can match
or better the performance of 'average' C code. i.e. C code that was
written by a good C programmer while no one was looking over his
shoulder, and no pressures motivated him to spend a lot of time
optimizing the C to the hilt, or switching to asm.

With the reading and writing of the data (which actually works out to
about 23MB, marshalled) now down to 1 second each, I'm content. In
the beginning, the io time was overshadowing the sort time by a good
bit. And it was the sort time that I wanted to highlight.

BTW, no one has responded to my challenge to best the original sample
Python code with C, C++, or asm.

.



Relevant Pages

  • Re: Chat Room Bots
    ... Thus, for a serious AI project you need to use C, C++, Fortran, asm or Ocaml. ... Speed critical AI-parts, like clustering, neural net training, pattern matching, genetic algorithms, planning, multi-sensor integration etc. are usually best implemented in a language that leads to the fastest implementation, allowing the input or modeling data to be as complete as possible for the given task. ... If I had to chose from Python and PHP, I would use Python, but ...
    (comp.programming)
  • Re: definition of a highlevel language?
    ... Other possible examples might be ctypes, numpy, array.array, and ... I heard a rumor that Python 3.0 might have optional type declarations. ... features wherever possible. ... The problem with in-line asm is that it's processor-specific; ...
    (comp.lang.python)
  • Re: age of Python programmers
    ... 15 ^^ been programming in python for about 2 weeks ... but i have prgrammed before in C and asm [16 + ... I decided to choose python as my scripting language ... New and Improved Yahoo! ...
    (comp.lang.python)