Bug 26405 - Performance improvements in read_block()
Summary: Performance improvements in read_block()
Status: RESOLVED NOTABUG
Alias: None
Product: XCB
Classification: Unclassified
Component: Library (show other bugs)
Version: 1.1
Hardware: All All
: medium enhancement
Assignee: xcb mailing list dummy
QA Contact: xcb mailing list dummy
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-03 01:46 UTC by Markus Fleschutz
Modified: 2010-02-03 16:57 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

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.