[sgen] Don't register pinned objects if pin stats are disabled
authorVlad Brezae <brezaevlad@gmail.com>
Thu, 7 Apr 2016 18:49:08 +0000 (21:49 +0300)
committerVlad Brezae <brezaevlad@gmail.com>
Fri, 27 May 2016 18:10:58 +0000 (21:10 +0300)
On some collections of fsharp, which had many pinned objects, this took up to 10 ms.

mono/sgen/sgen-pinning-stats.c

index 26fcfd116af32464cb5d01bcb1a6573144c5082e..23662f10be6e29b1d141e63ed33feb10d027cf66 100644 (file)
@@ -78,6 +78,8 @@ sgen_pin_stats_register_address (char *addr, int pin_type)
        PinStatAddress *node;
        int pin_type_bit = 1 << pin_type;
 
+       if (!do_pin_stats)
+               return;
        while (*node_ptr) {
                node = *node_ptr;
                if (addr == node->addr) {