lightingd: optimize json_add_short_channel_id a little.

MCP results from 5 runs, min-max(mean +/- stddev):
	store_load_msec:32825-36365(34615.6+/-1.1e+03)
	vsz_kb:2637488
	store_rewrite_sec:35.150000-36.200000(35.59+/-0.4)
	listnodes_sec:0.590000-0.710000(0.682+/-0.046)
	listchannels_sec:28.650000-31.080000(29.966+/-0.81)
	routing_sec:29.980000-33.100000(31.284+/-1.5)
	peer_write_all_sec:49.020000-52.890000(50.376+/-1.5)

MCP notable changes from previous patch (>1 stddev):
	-store_rewrite_sec:35.790000-37.500000(36.6375+/-0.63)
	+store_rewrite_sec:35.150000-36.200000(35.59+/-0.4)
	-listchannels_sec:34.600000-36.340000(35.36+/-0.77)
	+listchannels_sec:28.650000-31.080000(29.966+/-0.81)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2019-04-08 19:28:44 +09:30 committed by neil saitug
parent 20006b6553
commit 4811024518

View File

@ -110,10 +110,12 @@ struct command_result *param_pubkey(struct command *cmd, const char *name,
void json_add_short_channel_id(struct json_stream *response,
const char *fieldname,
const struct short_channel_id *id)
const struct short_channel_id *scid)
{
json_add_string(response, fieldname,
type_to_string(response, struct short_channel_id, id));
json_add_member(response, fieldname, "\"%dx%dx%d\"",
short_channel_id_blocknum(scid),
short_channel_id_txnum(scid),
short_channel_id_outnum(scid));
}
struct command_result *param_short_channel_id(struct command *cmd,