rfmvh / perfevents-result-collector

GNU General Public License v3.0
1 stars 1 forks source link

replace try..except by testing key existence #27

Open mpavlase opened 6 years ago

mpavlase commented 6 years ago

Handling raised exception is expensive operation (https://stackoverflow.com/a/2522013), it's much better to skip iteration by testing existence the key before actual usage.

https://github.com/rfmvh/perfevents-result-collector/blob/dc978b2f407636dfdfaca404149342fcae047a23/tests/run_tests.py#L40-L58