The Medusa distribution contains a small module that wraps the sendfile() system call, available at least on Unix and FreeBSD. The man page explains what sendfile() does: ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count) This call copies data between one file descriptor and another. Either or both of these file descriptors may refer to a socket (but see below). in_fd should be a file descriptor opened for reading and out_fd should be a descriptor opened for writing. offset is a pointer to a variable holding the input file pointer position from which sendfile() will start reading data. When sendfile() returns, this variable will be set to the offset of the byte following the last byte that was read. count is the number of bytes to copy between file descriptors. Because this copying is done within the kernel, sendfile() does not need to spend time transferring data to and from user space. sendfile() is used when writing really high-performance Web servers, in order to save an unnecessary memory-to-memory copy. Question: should I make up a patch to add a sendfile() wrapper to Python? (Personally I think we can live without it. If you're writing servers in Python, an interpreted language where creating an integer can end up calling malloc(), then worrying about the cost of memory-to-memory copying seems misplaced. Another strike against it is that it isn't portable; other Unixes have similar but different calls with different names.) --amk (www.amk.ca) "Aww, c'mon! Where's your sense of fun?" "I'm the standard model, Zachary. 'Fun' was optional." -- Zot and Peabody, in ZOT! #1
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4