Use pread and pwrite instead of lseek + write and read
От | Oskari Saarenmaa |
---|---|
Тема | Use pread and pwrite instead of lseek + write and read |
Дата | |
Msg-id | a86bd200-ebbe-d829-e3ca-0c4474b2fcb7@ohmu.fi обсуждение исходный текст |
Ответы |
Re: Use pread and pwrite instead of lseek + write and
read
Re: Use pread and pwrite instead of lseek + write and read |
Список | pgsql-hackers |
Hi, The Uber blog post, among other things, pointed out that PG uses lseek + read instead of pread. I didn't see any discussion around that and my Google searches didn't find any posts about pread / pwrite for the past 10 years. With that plus the "C++ port" thread in mind, I was wondering if it's time to see if we could do better by just utilizing newer C and POSIX features. The attached patch replaces FileWrite and FileRead with FileWriteAt and FileReadAt and removes most FileSeek calls. FileSeek is still around so we can find the end of a file, but it's not used for anything else. On my laptop a simple pgbench run (scale 100, 15 minutes) shows a 1.5% performance improvement. A 1.5% performance improvement is small but measurable - and IMV more importantly it allows us to drop more than 100 lines of backwards (compatible?) code; maybe we could start targeting more recent platforms in v10? Obviously this patch needs some more work before it could be merged, and we probably still need a fallback for some platforms without pread and pwrite (afaik Windows doesn't implement them.) / Oskari
Вложения
В списке pgsql-hackers по дате отправления: