Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store optimizations: the JSON parts #2541

Merged
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

fixup! gossipd: use simple inline array for nodes with few channels.

Suggested-by: @cdecker
Suggested-by: @niftynei
  • Loading branch information...
rustyrussell committed Apr 8, 2019
commit 9ed9c6d6f7a1662a82c1ce0ebafcc54386701359
@@ -79,7 +79,7 @@ static struct node_map *empty_node_map(const tal_t *ctx)
return map;
}

/* We use a simple array until we have too many. */
/* We use a simple array (with NULL entries) until we have too many. */
static bool node_uses_chan_map(const struct node *node)
{
/* This is a layering violation: last entry in htable is the table ptr,
@@ -105,6 +105,9 @@ static inline bool chan_eq_scid(const struct chan *c,
}
HTABLE_DEFINE_TYPE(struct chan, chan_map_scid, hash_scid, chan_eq_scid, chan_map);

/* For a small number of channels (by far the most common) we use a simple
* array, with empty buckets NULL. For larger, we use a proper hash table,
* with the extra allocation that implies. */
#define NUM_IMMEDIATE_CHANS (sizeof(struct chan_map) / sizeof(struct chan *) - 1)

struct node {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.