Skip to content

Commit 02e4667

Browse files
authored
Optimize clear_brick_table. (#65837)
I observed that the inlined call to clear_brick_table in clear_region_info took more CPU samples than necessary - it's about 7x faster to call memset than it is to code a straighforward loop.
1 parent 3cbed4b commit 02e4667

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/coreclr/gc/gc.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8034,8 +8034,9 @@ uint8_t* gc_heap::brick_address (size_t brick)
80348034

80358035
void gc_heap::clear_brick_table (uint8_t* from, uint8_t* end)
80368036
{
8037-
for (size_t i = brick_of (from);i < brick_of (end); i++)
8038-
brick_table[i] = 0;
8037+
size_t from_brick = brick_of (from);
8038+
size_t end_brick = brick_of (end);
8039+
memset (&brick_table[from_brick], 0, sizeof(brick_table[from_brick])*(end_brick-from_brick));
80398040
}
80408041

80418042
//codes for the brick entries:

0 commit comments

Comments
 (0)