Re: Proposal to introduce a shuffle function to intarray extension
От | Martin Kalcher |
---|---|
Тема | Re: Proposal to introduce a shuffle function to intarray extension |
Дата | |
Msg-id | 5ef15c6f-e108-53af-3d82-587fac394f1a@aboutsource.net обсуждение исходный текст |
Ответ на | Re: Proposal to introduce a shuffle function to intarray extension (Thomas Munro <thomas.munro@gmail.com>) |
Ответы |
Re: Proposal to introduce a shuffle function to intarray extension
Re: Proposal to introduce a shuffle function to intarray extension |
Список | pgsql-hackers |
Am 17.07.22 um 08:00 schrieb Thomas Munro: >> Actually ... is there a reason to bother with an intarray version >> at all, rather than going straight for an in-core anyarray function? >> It's not obvious to me that an int4-only version would have >> major performance advantages. > > Yeah, that seems like a good direction. If there is a performance > advantage to specialising, then perhaps we only have to specialise on > size, not type. Perhaps there could be a general function that > internally looks out for typbyval && typlen == 4, and dispatches to a > specialised 4-byte, and likewise for 8, if it can, and that'd already > be enough to cover int, bigint, float etc, without needing > specialisations for each type. I played around with the idea of an anyarray shuffle(). The hard part was to deal with arrays with variable length elements, as they can not be swapped easily in place. I solved it by creating an intermediate array of references to the elements. I'll attach a patch with the proof of concept. Unfortunatly it is already about 5 times slower than the specialised version and i am not sure if it is worth going down that road. Martin
Вложения
В списке pgsql-hackers по дате отправления: