Re: Use of instanceOf - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: Use of instanceOf
Date
Msg-id 40281919.2070900@opencloud.com
Whole thread Raw
In response to Use of instanceOf  (Dave Cramer <pg@fastcrypt.com>)
List pgsql-jdbc
Dave Cramer wrote:
> While reading the source code, I noticed we use instanceOf *alot* this
> is (used to be ? ) a fairly expensive operation. Does anyone know the
> state of the current technology, and what the cost of instanceof really
> is?

instanceof is cheap in comparison to the other work the driver does. I
wouldn't worry about it unless you have some benchmarks that point to it
as a real bottleneck.

> Then I guess the next question is how to refactor the instanceof out?

The main user is setObject() and friends. We can't avoid an instanceof
or getClass() in this case -- we need to know the runtime type of the
object to do anything sensible with it.

-O

pgsql-jdbc by date:

Previous
From: Pablo Velasquez Rivas
Date:
Subject: JDBC and intervals
Next
From: Dave Cramer
Date:
Subject: Re: JDBC and intervals