Hello:

On Mon, 12 Jun 2006, Tibor Simko wrote:
> Footnotes: 
> [1] Considering how pervasive exceptions in Python are, we would
>     probably not add much more overhead by adding our own exception
>     handling on top of it

Okay, so I did a few simple micro benchmarks for a function that
either (1) returns result or raises an exception; or (2) returns
(result, errors, warnings) tuple.  In case errors were never
encountered, the approach #1 was about 1.7 times faster than the
approach #2.  In case errors were encountered all the time, the
approach #1 was about 2.5 times slower.

Therefore, assuming that we shall use exceptions really to handle
mostly exceptional situations, the approach #1 seems more advantageous
both in terms of the programming convenience and of the execution
speed.

I'll therefore go with the exceptions in the run_sql() API.

The further plan is to use exceptions in parallel to the existing
error library for now, enrich the error library to register exceptions
too, and eventually rewrite it and convert the existing ERR_ and WRN_
messages too at some point in the future.

Best regards
-- 
Tibor Simko ** CERN IT-UDS ** Bldg 31-S-014 ** Voice: +41-22-7673527
CERN Document Server ** <http://cds.cern.ch/> ** <[email protected]>

Reply via email to