Micro optimizations welcome?
Ursache Vladimir
f35f22fan at gmail.com
Sun Sep 18 00:42:25 UTC 2016
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.
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;
};
More information about the wayland-devel
mailing list