libplugin: avoid memmove if we have many outputs to lightningd.

Use linked list, not an array.

```
+   97.89%     0.01%  autoclean  autoclean             [.] next_plan
-   97.08%     0.01%  autoclean  autoclean             [.] json_stream_output_write
   - 97.06% json_stream_output_write
      - 84.29% ld_stream_complete
         - 83.87% tal_arr_remove_
            + 83.71% __memcpy_avx_unaligned_erms (inlined)
      + 12.76% rpc_stream_complete
+   96.59%     0.03%  autoclean  autoclean             [.] tal_arr_remove_
+   96.48%     0.00%  autoclean  libc.so.6             [.] __memcpy_avx_unaligned_erms (inlined)
+   94.98%    94.98%  autoclean  libc.so.6             [.] __memmove_avx_unaligned_erms
+   84.29%     0.01%  autoclean  autoclean             [.] ld_stream_complete
+   12.76%     0.00%  autoclean  autoclean             [.] rpc_stream_complete
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-09-19 10:23:00 +09:30
committed by Christian Decker
parent 4d8c321517
commit 8b7a8265e7
3 changed files with 32 additions and 26 deletions

View File

@@ -292,7 +292,7 @@ int main(int argc, char *argv[])
bool ok = true;
/* Dummy for migration hooks */
struct plugin *plugin = tal(NULL, struct plugin);
plugin->js_arr = tal_arr(plugin, struct json_stream *, 0);
list_head_init(&plugin->js_list);
common_setup(argv[0]);

View File

@@ -1421,7 +1421,7 @@ int main(int argc, char *argv[])
bool ok = true;
/* Dummy for migration hooks */
struct plugin *plugin = tal(NULL, struct plugin);
plugin->js_arr = tal_arr(plugin, struct json_stream *, 0);
list_head_init(&plugin->js_list);
common_setup(argv[0]);