Hi, I noticed (*os.File).ReadFrom has supported splice(2) since go/1.21, and I'm trying to introduce it to my project. But the performance is not as expected, which is slower than the normal io.Copy (buffer size = 1MB). Does anyone who knows the reason?
For using splice(2), I tweaked the parameters: echo 655360 > /proc/sys/fs/pipe-user-pages-soft Some snippets for strace for splice(2): [pid 2663045] splice(316, NULL, 48, NULL, 38920, SPLICE_F_NONBLOCK <unfinished ...> [pid 2663045] <... splice resumed> ) = 38920 [pid 2663045] splice(222, NULL, 317, NULL, 199008, SPLICE_F_NONBLOCK <unfinished ...> [pid 2663045] <... splice resumed> ) = 80620 [pid 2663045] splice(316, NULL, 48, NULL, 80620, SPLICE_F_NONBLOCK <unfinished ...> [pid 2663045] <... splice resumed> ) = 80620 [pid 2663045] splice(222, NULL, 317, NULL, 118388, SPLICE_F_NONBLOCK <unfinished ...> [pid 2663045] <... splice resumed> ) = -1 EAGAIN (Resource temporarily unavailable) [pid 2663045] splice(222, NULL, 317, NULL, 118388, SPLICE_F_NONBLOCK <unfinished ...> [pid 2663045] <... splice resumed> ) = 14080 [pid 2663045] splice(316, NULL, 48, NULL, 14080, SPLICE_F_NONBLOCK <unfinished ...> [pid 2663045] <... splice resumed> ) = 14080 [pid 2663045] splice(222, NULL, 317, NULL, 104308, SPLICE_F_NONBLOCK <unfinished ...> [pid 2663045] <... splice resumed> ) = 26230 [pid 2663045] splice(316, NULL, 48, NULL, 26230, SPLICE_F_NONBLOCK <unfinished ...> [pid 2663045] <... splice resumed> ) = 26230 [pid 2663045] splice(222, NULL, 317, NULL, 78078, SPLICE_F_NONBLOCK <unfinished ...> [pid 2663045] <... splice resumed> ) = 19750 [pid 2663045] splice(316, NULL, 48, NULL, 19750, SPLICE_F_NONBLOCK <unfinished ...> [pid 2663045] <... splice resumed> ) = 19750 [pid 2663045] splice(222, NULL, 317, NULL, 58328, SPLICE_F_NONBLOCK <unfinished ...> [pid 2663045] <... splice resumed> ) = 58328 [pid 2663045] splice(316, NULL, 48, NULL, 58328, SPLICE_F_NONBLOCK <unfinished ...> [pid 2663045] <... splice resumed> ) = 58328 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/a525b1d5-f53a-4f1f-92c5-70c9c777941fn%40googlegroups.com.