scm: all_labels: use cons instead of append

it's faster.
This commit is contained in:
Dirk-Jan C. Binnema
2025-08-22 08:05:10 +03:00
parent cd249ffaf0
commit c207921cfa

View File

@ -184,10 +184,9 @@ subr_cc_store_all_labels(SCM store_scm) try {
SCM labels{SCM_EOL}; SCM labels{SCM_EOL};
for (const auto& [label, _n]: label_map) for (const auto& [label, _n]: label_map)
labels = scm_append_x( labels = scm_cons(to_scm(label), labels);
scm_list_2(labels,
scm_list_1(to_scm<std::string>(label)))); return scm_reverse_x(labels, SCM_EOL);
return labels;
} catch (const ScmError& err) { } catch (const ScmError& err) {
err.throw_scm(); err.throw_scm();