Bug 26405

Summary: Performance improvements in read_block()
Product: XCB Reporter: Markus Fleschutz <markus.fleschutz>
Component: LibraryAssignee: xcb mailing list dummy <xcb>
Status: RESOLVED NOTABUG QA Contact: xcb mailing list dummy <xcb>
Severity: enhancement    
Priority: medium    
Version: 1.1   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Markus Fleschutz 2010-02-03 01:46:14 UTC
in libxcb-1.5/src/xcb_in.c: read_block() should read: (replace the new ELSE by else)

...
        if(ret > 0)
            done += ret;
        ELSE if(ret < 0 && errno == EAGAIN)
        {
...
        }
        ELSE if(ret <= 0)
             return ret;
...

This saves 2 if() on partial read.
Comment 1 Julien Danjou 2010-02-03 01:55:52 UTC
I agree for the first else, but the second seems like a bad idea:
poll or select might return 0.
Comment 2 Bart Massey 2010-02-03 16:57:51 UTC
Inspection of the assembly code convinces me that the compiler does the right thing here, as I expected.  So there's no performance issue.  The style of the existing code isn't so bad, I think.  I tried some restructurings, and couldn't find one so much better that it was worth a patch.  So for now I think we'll leave the elses off.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.