Re: Use of instanceOf

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: pg(at)fastcrypt(dot)com
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Use of instanceOf
Date: 2004-02-09 23:34:49
Message-ID: 40281919.2070900@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2004-02-09 23:52:05 Re: JDBC and intervals
Previous Message Pablo Velasquez Rivas 2004-02-09 21:11:27 JDBC and intervals