Re: Use of instanceOf

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: Use of instanceOf
Дата
Msg-id 40281919.2070900@opencloud.com
обсуждение исходный текст
Ответ на Use of instanceOf  (Dave Cramer <pg@fastcrypt.com>)
Список 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 по дате отправления:

Предыдущее
От: Pablo Velasquez Rivas
Дата:
Сообщение: JDBC and intervals
Следующее
От: Dave Cramer
Дата:
Сообщение: Re: JDBC and intervals