Skip to content

Commit 79b8323

Browse files
committed
feat: slightly improve compilation times
1 parent 9f04f54 commit 79b8323

File tree

4 files changed

+26
-12
lines changed

4 files changed

+26
-12
lines changed

ecsact/entt/execution.hh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ auto execute_actions( //
128128
)");
129129
}
130130

131+
using execute_fn_t = void (*)(
132+
::entt::registry& registry,
133+
ecsact_system_execution_context* parent,
134+
const ecsact::entt::actions_map& actions_map
135+
);
136+
131137
/**
132138
* Allocates EnTT groups and storage if necessary for the system or action.
133139
* NOTE: Template specializations are made available via the codegen plugin

rt_entt_codegen/core/execute_systems.cc

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,24 @@ auto ecsact::rt_entt_codegen::core::print_parallel_system_execute(
2020
using ecsact::cpp_codegen_plugin_util::block;
2121
using ecsact::rt_entt_codegen::util::method_printer;
2222

23+
ctx.write("template<std::size_t N>\n");
2324
auto printer = //
2425
method_printer{ctx, "ecsact_execute_parallel_cluster"} //
2526
.parameter("::entt::registry&", "registry")
2627
.parameter("ecsact_system_execution_context*", "parent_context")
27-
.parameter("auto", "system_arr")
28+
.parameter("std::array<exec_entry_t, N>", "system_arr")
2829
.return_type("void");
2930

30-
ctx.write(
31-
"std::for_each(std::execution::par_unseq\n, system_arr.begin()\n, "
32-
"system_arr.end()\n, "
31+
block(
32+
ctx,
33+
"std::for_each(std::execution::par_unseq, system_arr.begin(), "
34+
"system_arr.end(), [&registry](exec_entry_t pair)",
35+
[&]() {
36+
ctx.write("auto fn_ptr = pair.first;\n");
37+
ctx.write("auto actions_map = pair.second;\n");
38+
ctx.write("fn_ptr(registry, nullptr, actions_map);");
39+
}
3340
);
34-
block(ctx, "[&](auto pair)", [&]() {
35-
ctx.write("auto fn_ptr = pair.first;\n");
36-
ctx.write("auto actions_map = pair.second;\n");
37-
ctx.write("fn_ptr(registry, nullptr, actions_map);");
38-
});
3941
ctx.write(");\n");
4042
}
4143

rt_entt_codegen/rt_entt_codegen.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ void ecsact_codegen_plugin(
6464
}
6565
ctx.write("\n");
6666

67+
ctx.write("// test1234\n");
68+
ctx.write(
69+
"using exec_entry_t = std::pair<ecsact::entt::execute_fn_t, const "
70+
"ecsact::entt::actions_map&>;\n\n"
71+
);
72+
6773
init_global(ctx, "registries");
6874
init_global(ctx, "last_registry_id");
6975
init_global(ctx, "system_impls");

rt_entt_codegen/shared/parallel.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,20 @@ auto ecsact::rt_entt_codegen::parallel::print_parallel_system_executions(
7676
} else {
7777
ctx.write("ecsact_execute_parallel_cluster(registry, nullptr, ");
7878
}
79-
ctx.write("std::array {\n");
79+
ctx.write("std::array<exec_entry_t,", systems_to_parallel.size(), ">{\n");
8080
for(const auto system_like_id : systems_to_parallel) {
8181
auto cpp_decl_name =
8282
cpp_identifier(ecsact::meta::decl_full_name(system_like_id));
8383

8484
if(details.is_action(system_like_id)) {
8585
ctx.write(
86-
"std::pair{&ecsact::entt::execute_actions<",
86+
"exec_entry_t{&ecsact::entt::execute_actions<",
8787
cpp_decl_name,
8888
">, actions_map},\n"
8989
);
9090
} else if(details.is_system(system_like_id)) {
9191
ctx.write(
92-
"std::pair{&ecsact::entt::execute_system<",
92+
"exec_entry_t{&ecsact::entt::execute_system<",
9393
cpp_decl_name,
9494
">, actions_map},\n"
9595
);

0 commit comments

Comments
 (0)