lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [lucenenet] jeme commented on pull request #373: Remove delegate based debugging assert
Date Mon, 26 Oct 2020 08:45:17 GMT

jeme commented on pull request #373:
URL: https://github.com/apache/lucenenet/pull/373#issuecomment-716401707


   > AOP could potentially save us from having to go down the road of specializing asserts
in the name of performance. It might be costly, but when compared against trying to maintain
a diverging set of asserts and `Assert` methods that require an `if` block outside of them
in order to optimize performance, it might be worth it. Perhaps a small example is in order
of AOP. Although, years ago when I checked there didn't appear to be any mainstream open source
AOP libraries, which would kill that idea immediately if it is still the case.
   
   There is some fairly mature AOP frameworks out there, however not all will be suitable
for what we need here. E.g. I still think PostSharp, which is one of the bigger ones, is focused
on Compile time AOP which makes it unsuitable here as we are looking for a Runtime.
   
   Harmony works at runtime so that could be a candidate, it's has apparently been mostly
used to mod games, but that shouldn't matter. The bigger problem though is that the `Debugging.Assert`
is not only used on Method entry in Lucene, which means we need to somehow get around this
problem as we can't just inject code into the middle of a method (AFAIK, at least not with
ease)...
   
   I was thinking that one approach for this could be to pull out the actual assert into it's
own method in each class (A .NET specific method)... That would introduce a call to a "NOOP"
by default at runtime, and that could then be replace. The consequence here though is that
then we may not even need AOP at all to replace the logic as we can perhaps inject it instead...
(But I want to perform some experiments to look into the performance cost of a "NOOP" in various
scenarios vs the boolean check we have now..


----------------------------------------------------------------
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.

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



Mime
View raw message