-
Notifications
You must be signed in to change notification settings - Fork 0
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
High CPU usage #1
Comments
Hi @esroyo, can you please take a look at this? It appears performance is suffering due to a call to Deno's performance API itself, specifically function findMostRecent(
name,
type,
) {
return ArrayPrototypeFind(
ArrayPrototypeReverse(ArrayPrototypeSlice(performanceEntries)),
(entry) => entry.name === name && entry.entryType === type,
);
} This must be due to a memory leak, right? We are saving too many entries and then not clearing them, so the list gets longer and longer over time. Is there anything we can do on our end (or within this library) to prevent that? EDIT: Maybe I just need to call EDIT2: https://gitlab.com/soapbox-pub/ditto/-/merge_requests/141 |
@alexgleason I'm very sorry to be this late, the notification got totally overlooked 😔 🙏 Your reasoning makes every sense: if there is a problem of time accessing the given measure or mark, it must be form the underlying native Performance implementation, in this case Deno's. The only thing we can do from user-land is to make sure the given measures/marks are removed once the instance is not needed any more (as you already did). Probably it is a good idea to implement {
using perf = new ScopedPerformance();
perf.mark('start');
// ...
const { duration } = perf.measure('end', 'start');
}
// when `perf` is not accessible any more, this should happen out-of-the-box
// perf.clearMarks();
// perf.clearMeasures(); |
Thanks for your report @alexgleason, again my apologies for late response 🙏 |
That's perfect. Thank you @esroyo ! |
Hi, thank you for this great library! It helped me a lot for finding slow queries. But sometimes, under certain conditions I don't understand, the library itself seems to contribute to slowing down my code.
Check this one, for instance. 5.85ms of
measure
:It seems to add up, and often calling
measure
takes more time than the query itself:However, this doesn't seem to be a problem when the process first starts... only after it has been running for a while. It it possible I have a memory leak and need to do cleanup? Here is the method I am calling:
Here is the cpuprofile so you can take a look yourself:
mostr-measure-highcpu.cpuprofile
You can load it into Chrome DevTools here:
The text was updated successfully, but these errors were encountered: