Micro optimizations welcome?

Giulio Camuffo giuliocamuffo at gmail.com
Sun Sep 18 05:11:09 UTC 2016


2016-09-18 4:03 GMT+03:00 Yong Bakos <junk at humanoriented.com>:
> On Sep 17, 2016, at 5:42 PM, Ursache Vladimir <f35f22fan at gmail.com> wrote:
>>
>> Hi,
>> On amd64 struct wl_display from wayland-client.c can shrink in size
>> from 320 bytes to 304 if two fields (last_error and id) are
>> rearranged. Compiles fine.
>
> I believe you mean last_error and protocol_error.
> This will change the ABI (did you try an ABI check?) and we can't do
> that at this time.

No, wl_display is an opaque type so we can change its size and fields
without problems.

>
> yong
>
>
>
>> End result looks like this:
>>
>> struct wl_display {
>>    struct wl_proxy proxy;
>>    struct wl_connection *connection;
>>
>>    /* When display gets an error event from some object, it stores
>>     * information about it here, so that client can get this
>>     * information afterwards */
>>    struct {
>>        /* Code of the error. It can be compared to
>>         * the interface's errors enumeration. */
>>        uint32_t code;
>>        /* id of the proxy that caused the error. There's no warranty
>>         * that the proxy is still valid. It's up to client how it will
>>         * use it */
>>        uint32_t id;
>>        /* interface (protocol) in which the error occurred */
>>        const struct wl_interface *interface;
>>    } protocol_error;
>>    /* errno of the last wl_display error */
>>    int last_error;
>>    int fd;
>>    struct wl_map objects;
>>    struct wl_event_queue display_queue;
>>    struct wl_event_queue default_queue;
>>    pthread_mutex_t mutex;
>>
>>    int reader_count;
>>    uint32_t read_serial;
>>    pthread_cond_t reader_cond;
>> };
>> _______________________________________________
>> wayland-devel mailing list
>> wayland-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list