texteq/byteaeq: avoid detoast

Поиск
Список
Период
Сортировка
От Noah Misch
Тема texteq/byteaeq: avoid detoast
Дата
Msg-id 20101220181953.GB29282@tornado.gateway.2wire.net
обсуждение исходный текст
Ответы Re: texteq/byteaeq: avoid detoast  (Robert Haas <robertmhaas@gmail.com>)
texteq/byteaeq: avoid detoast [REVIEW]  (Andy Colson <andy@squeakycode.net>)
Re: texteq/byteaeq: avoid detoast  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
texteq, textne, byteaeq and byteane detoast their arguments, then check for
equality of length.  Unequal lengths imply the answer trivially; given equal
lengths, the functions proceed to compare the actual bytes.  We can skip
detoasting entirely when the lengths are unequal.  The attached patch implements
this.  As submitted, it applies atop of my recent strncmp->memcmp patch, but
they are logically independent.  To benchmark some optimal and pessimal cases, I
used the attached "bench-skip-texteq.sql".  It uses a few datum sizes and varies
whether the length check succeeds:

bench-skip-texteq.sql, 10 MiB nomatch: 58.4s previous, 0.00664s patched
bench-skip-texteq.sql,  144 B   match: 73.0s previous, 71.9s patched
bench-skip-texteq.sql,    3 B   match: 68.8s previous, 67.3s patched
bench-skip-texteq.sql,    3 B nomatch: 45.0s previous, 46.0s patched

The timing differences in the smaller-length test cases are probably not
statistically significant.

Thanks,
nm

Вложения

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

Предыдущее
От: Noah Misch
Дата:
Сообщение: strncmp->memcmp when we know the shorter length
Следующее
От: Tom Lane
Дата:
Сообщение: Re: MingW and MiniDumps