Re: patch: tiny patch to correct stringbuffer size estimate

Поиск
Список
Период
Сортировка
От Fernando Nasser
Тема Re: patch: tiny patch to correct stringbuffer size estimate
Дата
Msg-id 3F1D50F6.9040002@redhat.com
обсуждение исходный текст
Ответ на patch: tiny patch to correct stringbuffer size estimate  (Oliver Jowett <oliver@opencloud.com>)
Список pgsql-jdbc
Oliver Jowett wrote:
> On Tue, Jul 22, 2003 at 10:36:01AM -0400, Fernando Nasser wrote:
>
>>This is already accounted for in the 10% that is added to it, isn't it?
>
>
> Only if you have a string > 20 characters, due to truncation on integer
> division, no?
>

Good point, although the doubling of the Buffer pool is irrelevant in
those cases.  Any difference is only measurable in the hundreds of K sizes.

Anyway, it will not hurt adding 2.

Regards,
Fernando


>>Oliver Jowett wrote:
>>
>>>This patch tweaks the size estimate when escaping strings to count the
>>>enclosing quotes.
>>
>
>>>*** AbstractJdbc1Statement.java    22 Jul 2003 05:17:09 -0000    1.28
>>>--- AbstractJdbc1Statement.java    22 Jul 2003 13:53:03 -0000
>>>***************
>>>*** 1034,1040 ****
>>>             synchronized (sbuf)
>>>             {
>>>                 sbuf.setLength(0);
>>>!                 sbuf.ensureCapacity(x.length() +
>>>(int)(x.length() / 10));
>>>                 sbuf.append('\'');
>>>                 escapeString(x, sbuf);
>>>                 sbuf.append('\'');
>>>--- 1034,1040 ----
>>>             synchronized (sbuf)
>>>             {
>>>                 sbuf.setLength(0);
>>>!                 sbuf.ensureCapacity(2 + x.length() +
>>>(int)(x.length() / 10));
>>>                 sbuf.append('\'');
>>>                 escapeString(x, sbuf);
>>>                 sbuf.append('\'');
>>
>


--
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Dmitry Tkach
Дата:
Сообщение: Re: the IN clause saga
Следующее
От: Fernando Nasser
Дата:
Сообщение: Re: the IN clause saga