[Python-ideas] multiple objects handling
Nick Coghlan
ncoghlan at gmail.com
Sat Aug 13 02:54:21 CEST 2011
On Sat, Aug 13, 2011 at 8:18 AM, Peter V. Saveliev <peet at altlinux.ru> wrote:
>> Have you actually profiled the performance of your program? I would
>> guess that the time spent dispatching through a dictionary is dwarfed by
>> the time spent constructing those event objects and the ultimate
>> processing of them.
>
> You're right, but having really huge stream of packets I try to minimize
> any overhead — using C modules, ctypes library and so on. But I hope to
> save high-level logic in Python, and before to reject a chance to speed
> up parsing, I asked for some alternatives and contras. I believe that
> method calls here are unnecessary while the «if» statements tree makes
> the code hard to support.
This kind of logic micro-optimisation is best handled by a JIT
compiler rather than messing with the language definition and asking
people to do it by hand. I suggest running your application on PyPy
and seeing what kind of speed up you get.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list