.net BitArray.Get performance issue

c# .net performance entity-framework-6 bitarray

173 просмотра

1 ответ

I have an asp.net application and trying to optimize it performance. I find one issue with BitArray.Get method performance. It's execution time differs from 100 to 250ms. It's defiantly too much. This method called inside IEnumerable.FirstOrDefault. Is there any idea why this happening and how to optimize it?

enter image description here


This method call appears during EF materialization. one more example from same trace: enter image description here

There are also other examples with method processing duration just 1ms.

Автор: IAfanasov Источник Размещён: 08.11.2019 11:24

Ответы (1)

2 плюса


You are misinterpreting the data.

In your second picture BitArray.Get() takes about the 3 times as long compared to the first picture and the number of calls is about 3 times as high as well (~3.1mio compared to ~1.2mio). Therefore I conclude that the time in ms reflects these millions of calls, not just one call! In both cases the time per call is around ~200ns per call (218 and 201 ns). There is just a difference of 8.4 percent. This is pretty consistent.

BitArray.Get() is ~ 1 mio times faster than you thought!

Автор: Olivier Jacot-Descombes Размещён: 21.08.2016 05:21
Вопросы из категории :