| От | Oliver Jowett |
|---|---|
| Тема | Re: Performance of loop |
| Дата | |
| Msg-id | 42706503.7080800@opencloud.com обсуждение исходный текст |
| Ответ на | Performance of loop (Gnanavel S <s.gnanavel@gmail.com>) |
| Ответы |
Re: Performance of loop
|
| Список | pgsql-jdbc |
Gnanavel S wrote:
> In the above coding, say if the length of the query is 1000 characters
> then the query.length() is evaluated 1000 times there by reducing the
> performance.
> I think the loop can be rewritten as
>
> for (int i = 0,c=query.length(); i < c; ++i)
> {
> char c = query.charAt(i);
>
> ....
> .....
> }
Have you benchmarked this? I doubt it's really a hotspot given that the
JIT is likely to inline length(). Premature optimization and all that..
-O
В списке pgsql-jdbc по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера