Any performance issues if non-async function runs an async, compared to running async alone

On discordjs.guide, this is suggested
for (const event of events) {
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
} else {
client.on(event.name, (...args) => {
event.execute(...args);
});
}
}
for (const event of events) {
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
} else {
client.on(event.name, (...args) => {
event.execute(...args);
});
}
}
But if I were to write manually
client.on(Events.InteractionCreate, async (interaction) -> {...}
client.on(Events.InteractionCreate, async (interaction) -> {...}
It would be like this, where the function in the client.on parameter would be async. In the first one though, it is non-async function running an async function, will it have any performance issues?
2 Replies
d.js toolkit
d.js toolkit3w ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
chewie 🌈
chewie 🌈3w ago
the top one just calls the function, doesnt matter if its async or not