Python Forum
multiprocessing Pipe.poll very slow
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
multiprocessing Pipe.poll very slow
#1
I reduced the cpu usage of my program by more than half by using select.poll rather than the Pipe's own poll routine:

in __init__
...
        self.pollin = select.poll()
        self.pollin.register(self.pipe, select.POLLIN)
...


    def readline(self):
#        if self.pipe.poll():   # pipe poll is really slow!!!!!  better use our own                                             
        if self.pollin.poll(0):
            return self.pipe.recv()
        return False
I measured the time from before and after calling pipe.poll and it's more than 10 times slower than using the select poll routine but does exactly the same thing from what I can tell except I have to pass 0 to avoid blocking.


Where is the actual implementation? So why would this be so slow?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pipe traceback to a C program Alexandros 0 686 Oct-22-2024, 12:32 PM
Last Post: Alexandros
  BrokenPipeError: [Errno 32] Broken pipe throwaway34 6 17,892 May-06-2021, 05:39 AM
Last Post: throwaway34
  2 or more processes on the write end of the same pipe Skaperen 4 5,773 Sep-27-2020, 06:41 PM
Last Post: Skaperen
  should i use os.poll() for 2 reads? Skaperen 2 3,103 Jul-08-2018, 01:52 AM
Last Post: Skaperen
  faster socket with multiprocessing.Pipe sixteenornumber 2 7,900 Dec-10-2016, 06:52 PM
Last Post: sixteenornumber
  Filtering an interactive CLI command via pipe(s) Skaperen 2 5,000 Nov-23-2016, 09:17 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020