-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Defer calling canEnableFFmpegOptimizations on module load #9859
Comments
@JMTK can you explain this a bit more |
Sure! I was recently profiling my bot to investigate sporadic CPU spikes. While I was doing this, unrelated to anything I was actually looking for, I noticed that every time I was profiling on bot startup without doing anything, I saw (IMO) Ideally someone who just importing the Ultimately this would be moved to somewhere else where it would call it initially if it had never been called before when you're actually trying to do something with ffmpeg. |
@JMTK i Understand the issue now |
Which package is this bug report for?
@discord.js/voice
Issue description
On app startup, I noticed that there were calls to
canEnableFFmpegOptimizations()
, despite not actually doing anything with voice for some testing I was doing. I do include discord.js/voice code elsewhere. It seems like in https://github.com/discordjs/voice/blob/309ac8596cac422cf22e51331869e011c720124c/src/audio/TransformerGraph.ts#L169, it is calling it just when the module is require/imported. I think this could be moved elsewhere somehow to only call it the first time the nodes are actually referenced somewhere, which should improve app startup time.Code sample
Run
node --prof bot.js
Run
node --prof-process isolate...log > processed.txt
:Versions
Issue priority
Low (slightly annoying)
Which partials do you have configured?
Not applicable
Which gateway intents are you subscribing to?
Not applicable
I have tested this issue on a development release
No response
The text was updated successfully, but these errors were encountered: