takluyver/pyxdg — pull request #3 by ju1ius (2013-02-05 17:16:10+00:00)
Title: Used ast module to compile menu rules matching code

Kudos for your awesome documentation on the ast module.
I've been able to port my previous implementation in just about the time needed to understand the docs !

I've made a little benchmark just to show the improvements.
I ran each of the implementations 10 times against three different menu files: a small one (LXDE's - 4Ko), a medium one (hand-rolled - 7Ko) and a big one (KDE4's - 11Ko). For each implementation, I kept only the best scores.
Results are in seconds

```
+---------------------------+-------------------+-----------------+-------------------+
| | lxde-applications | my-applications | kde4-applications |
+---------------------------+-------------------+-----------------+-------------------+
| takluyver/pyxdg-master | 0.080 | 0.090 | 0.190 |
+---------------------------+-------------------+-----------------+-------------------+
| ju1ius/pyxdg-rules-noeval | 0.060 | 0.070 | 0.090 |
+---------------------------+-------------------+-----------------+-------------------+
| ju1ius/pyxdg-rules-ast | 0.050 | 0.060 | 0.070 |
+---------------------------+-------------------+-----------------+-------------------+
```