NightOwl888 commented on issue #1062:
URL: https://github.com/apache/lucenenet/issues/1062#issuecomment-2524844734

   A word of caution here. The first stab at implementing `Debugging.Assert()` 
used `Func<bool>`:
   
   - https://github.com/apache/lucenenet/pull/327
   
   We found that using this approach was very detrimental to performance. At 
the time, it was presumed that this was due to the lambda capture allocations 
rather than the use of `Func<bool>` (which could be passed a method that 
returns `bool` instead) but no benchmark was done to determine which of these 
(or both) caused the performance degradation.
   
   - https://github.com/apache/lucenenet/pull/372
   - https://github.com/apache/lucenenet/pull/373
   
   There was also an effort to factor out some hand coded classes. For example:
   
   
https://github.com/apache/lucenenet/blob/d597a5f38a6a2d78e075545190368735596ddcab/src/Lucene.Net/Search/FieldCache.cs#L382
   
   That effort was stopped as soon as we discovered that using lambdas was very 
costly, but we didn't go back and revert those to hand-coded classes, either. 
Maybe we wouldn't have to if we could pass it a function instead of a lambda, 
which may not incur the allocation overhead. Benchmarking is needed.
   
   Giving it a similar UX as Lucene is great, but if it incurs a significant 
performance penalty, we should stick with the hand-coded classes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to