[MERGE] pyrex bencode implementation

Aaron Bentley aaron.bentley at utoronto.ca
Wed Aug 15 19:30:49 BST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alexander Belchenko wrote:
> Here is the patch for pyrex bencode version.
> 
> I create simple benchmark for tags serialization/deserialization
> (i.e. indirect benchmark for bencode). This benchmark use
> tags dictionary with 100 items.
> 
> Here results on my machine (CeleronM 1.7GHz Windows XP)
> 
> Pure python bencode:
> 
>      906ms bzrlib.benchmarks.bench_tags.TagsBencodeBenchmark.test_deserialize_tags
>      656ms bzrlib.benchmarks.bench_tags.TagsBencodeBenchmark.test_serialize_tags
> 
> Pyrex version:
> 
>      375ms bzrlib.benchmarks.bench_tags.TagsBencodeBenchmark.test_deserialize_tags
>      453ms bzrlib.benchmarks.bench_tags.TagsBencodeBenchmark.test_serialize_tags
> 
> These numbers are for 1000-iteration loop, so you need to divide time by 1000,
> i.e. it's actually us not ms for 1 iteration.

BB:abstain

So that makes it .906ms for the python implementation and .375ms for the
pyrex implementation?  That doesn't sound worth it to me.

Remember, increasing performance isn't about just optimizing anything we
can.  Optimization always has a cost, usually in code clarity and
increased maintenance.

So optimization should start with profiling the code, seeing what parts
of what operation are slow, and then deciding the correct way to improve
performance.

For all I know, your performance win comes simply from avoiding function
call overhead, and that could be fixed without Pyrex.

HACKING says a patch should "Improves bugs, features, speed, or code
simplicity"

This patch reduces code simplicity, and the speed increases don't seem
to be substantial.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGw0ZZ0F+nu1YWqI0RAld0AJ4m8bIfgo4g647ei/PvzcKCGDjMkgCfWhKP
809er9BaUiXr/4unIJYdm+4=
=/DD6
-----END PGP SIGNATURE-----



More information about the bazaar mailing list