Open An00nymushun opened 2 years ago
Considering v2 is in maintenance only, there's not much interest in adding new features or doing anything much than base maintenance and ensure it still works with Discord updates.
While scanning twice is not really ideal, it's unlikely there'll ever be enough injections for it to have a real, noticeable impact. Moreover, perf_hooks is only precise up to milliseconds, whereas hrtime is outputting nanoseconds which is very useful for cases where we have sub-millisecond runtimes (which can easily happen with small injections on high end machines). There's on top of that code-style issues.
Considering all the above and current state of v2 while v3 is indev, this pr will probably not be merged, the benefits being too minor in this context.
I didn't know hrtime was in nanoseconds, but both are high precision, it's just that the performance one is multiplied so it's milliseconds plus fractions.
I don't get what you mean by code-style issues and where is the code for v3?
Most importantly, I removed the part where it scans through all the injections twice, to find all the ones that match the called method. I also made the debugging code a bit better by only showing hooks that actually ran and added better performance measurements by using perf_hooks.