Reorder chan struct to reduce cache misses

This commit is contained in:
Rodrigo Arias 2023-02-17 17:16:25 +01:00 committed by Rodrigo Arias Mallo
parent 2d8b68bff2
commit c72f71e61e
2 changed files with 7 additions and 7 deletions

View File

@ -98,10 +98,10 @@ chan_set(struct chan *chan, struct value value)
return -1; return -1;
} }
#ifdef ENABLE_DEBUG
char buf[128]; char buf[128];
UNUSED(buf); dbg("%s: sets value to %s", chan->name, value_str(value, buf));
dbg("%s: sets value to %s\n", #endif
chan->name, value_str(value, buf));
chan->data.value = value; chan->data.value = value;
if (set_dirty(chan) != 0) { if (set_dirty(chan) != 0) {

View File

@ -43,14 +43,14 @@ struct chan;
typedef int (*chan_cb_t)(struct chan *chan, void *ptr); typedef int (*chan_cb_t)(struct chan *chan, void *ptr);
struct chan { struct chan {
char name[MAX_CHAN_NAME];
enum chan_type type;
union chan_data data;
int is_dirty; int is_dirty;
int prop[CHAN_MAXPROP]; int prop[CHAN_MAXPROP];
struct value last_value;
chan_cb_t dirty_cb; chan_cb_t dirty_cb;
void *dirty_arg; void *dirty_arg;
struct value last_value;
enum chan_type type;
union chan_data data;
char name[MAX_CHAN_NAME];
}; };
void chan_init(struct chan *chan, enum chan_type type, const char *fmt, ...); void chan_init(struct chan *chan, enum chan_type type, const char *fmt, ...);