mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 12:35:14 +00:00
LibCore: Use JsonObject::get_ptr() in CProcessStatisticsReader
This removes a bunch of JsonValue copying from the hot path in thread statistics fetching. Also pre-size the thread statistics vector since we know the final size up front. :^)
This commit is contained in:
parent
7011dba98e
commit
1b2c6e8f41
Notes:
sideshowbarker
2024-07-19 10:32:02 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/1b2c6e8f41a
1 changed files with 2 additions and 1 deletions
|
@ -44,7 +44,8 @@ HashMap<pid_t, CProcessStatistics> CProcessStatisticsReader::get_all()
|
|||
process.amount_purgeable_nonvolatile = process_object.get("amount_purgeable_nonvolatile").to_u32();
|
||||
process.icon_id = process_object.get("icon_id").to_int();
|
||||
|
||||
auto thread_array = process_object.get("threads").as_array();
|
||||
auto& thread_array = process_object.get_ptr("threads")->as_array();
|
||||
process.threads.ensure_capacity(thread_array.size());
|
||||
thread_array.for_each([&](auto& value) {
|
||||
auto& thread_object = value.as_object();
|
||||
CThreadStatistics thread;
|
||||
|
|
Loading…
Add table
Reference in a new issue