module: invert switch case for hypothetically better branch prediction
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
ea14480246
commit
2e7cb30bc9
1 changed files with 4 additions and 5 deletions
|
|
@ -298,11 +298,10 @@ pub fn Modules(comptime mods: anytype) type {
|
||||||
/// Call local event handler with the specified name in the specified module
|
/// Call local event handler with the specified name in the specified module
|
||||||
inline fn callLocal(module_name: ModuleName(mods), event_name: LocalEvent, args: []u8, injectable: anytype) !void {
|
inline fn callLocal(module_name: ModuleName(mods), event_name: LocalEvent, args: []u8, injectable: anytype) !void {
|
||||||
if (@typeInfo(@TypeOf(event_name)).Enum.fields.len == 0) return;
|
if (@typeInfo(@TypeOf(event_name)).Enum.fields.len == 0) return;
|
||||||
// TODO: invert switch case for hypothetically better branch prediction
|
switch (event_name) {
|
||||||
switch (module_name) {
|
inline else => |ev_name| {
|
||||||
inline else => |mod_name| {
|
switch (module_name) {
|
||||||
switch (event_name) {
|
inline else => |mod_name| {
|
||||||
inline else => |ev_name| {
|
|
||||||
const M = @field(NamespacedModules(@This().modules){}, @tagName(mod_name));
|
const M = @field(NamespacedModules(@This().modules){}, @tagName(mod_name));
|
||||||
_ = ModuleInterface(M); // Validate the module
|
_ = ModuleInterface(M); // Validate the module
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue