From: Vlad Brezae Date: Thu, 22 Jun 2017 20:15:53 +0000 (+0300) Subject: [sgen] Performance improvement for ms_block_size computations X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mono.git;a=commitdiff_plain;h=3ea09f9c8f10097e50b94702c1e4a06cb7517c4c [sgen] Performance improvement for ms_block_size computations This reduces regressions for switching from MS_BLOCK_SIZE compile time constant to ms_block_size variable by 85% on the tests where this was showing up. In the future we should implement a block allocator, which would, amongst other benefits, enable us to remove the block-size/page-size dependency. --- diff --git a/mono/sgen/sgen-marksweep.c b/mono/sgen/sgen-marksweep.c index e496288a2e7..7711679e3cb 100644 --- a/mono/sgen/sgen-marksweep.c +++ b/mono/sgen/sgen-marksweep.c @@ -1409,10 +1409,10 @@ static inline void sweep_block_for_size (MSBlockInfo *block, int count, int obj_size) { int obj_index; + void *obj = MS_BLOCK_OBJ_FOR_SIZE (block, 0, obj_size); - for (obj_index = 0; obj_index < count; ++obj_index) { + for (obj_index = 0; obj_index < count; ++obj_index, obj = (void*)((mword)obj + obj_size)) { int word, bit; - void *obj = MS_BLOCK_OBJ_FOR_SIZE (block, obj_index, obj_size); MS_CALC_MARK_BIT (word, bit, obj); if (MS_MARK_BIT (block, word, bit)) {