[cairo] Error checking in language bindings
Michael Urman
murman at gmail.com
Thu Dec 13 19:15:00 PST 2007
On Dec 13, 2007 7:33 PM, Steven Chaplin <stevech1097 at yahoo.com.au> wrote:
> So for a Python binding for cairo it looks like you must choose to use
> either
> 1) cairo-style error checking - manually call cairo_status() when
> required, or
> 2) Python-style error checking - using exceptions.
>
> I think using cairo-style error checking and being able to call smaller
> and faster drawing operations is something than many graphics
> application programmers would prefer.
If I look at this from the perspective of being the client python
code, I would not want to have to write error-checking code. The whole
point of a exceptions is to be able to sidestep the exceptions.
If I consider the performance impact of this scenario, the waters
become a little murky. The overhead for a function call in python is
fairly high, so I would not expect explicit status checks in the
python code to be a win, especially since I also assume that the
C-level status checks are fairly trivial and do not provide much
overhead.
It might be interesting to profile the difference between C-level
checks embedded in every function call, never embedded, and perhaps
embedded only in, e.g., the fundamental drawing operations. This would
get a measure of the extremes, as well as one potential compromise
scenario, and help shape this discussion.
Michael
--
Michael Urman
More information about the cairo
mailing list