NightOwl888 commented on pull request #347:
URL: https://github.com/apache/lucenenet/pull/347#issuecomment-699979998


   > > Is your recommendation to use `Lazy` also based on the incorrect 
assumption that `Debugging.AssertsEnabled` reads the value from the dictionary 
every time it is read, or is there actually some benefit to using `Lazy` in 
this instance?
   
   > It was because I miss read the change as if it was a changed property. As 
such, I read it as a `=>` instead of a `=` - maybe a "brain autocorrect" 
because I would avoid public fields in all cases, so I expected it to be a 
Property before and now it became a cached Property. Seeing as it was a Field 
before, The change has little value i guess... I would change it to a property 
in that case though. So:
   
   > ```
   > public static bool AssertsEnabled { get; set; }= 
SystemProperties.GetPropertyAsBoolean("assert", false);
   > ```
   
   Actually, the field was by design to make it as cheap as possible to check 
the value, ensuring that the compiler has no chance to get the optimizations 
wrong. 
   
   The naming convention was such that it would not need to be changed if it 
were made into a public property someday.
   
   
   > You said you had access to JetBrains resharper though an Apache free use 
program, does that include dotMemory? It''s a fairly decent tool for doing 
memory profiling and it can certainly tell you which objects you have hanging 
around. It will also allow you to do a run with the flag on, safe a snapshot, 
then do a run without the flag and compare the two snapshots etc...
   
   > (It will be most straight forward if you can make your testing into a 
executeable you can run from it)
   
   Thanks for the suggestion. I do have access to dotMemory, and I will give it 
a shot when I get a chance (unless you beat me to it).


----------------------------------------------------------------
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:
[email protected]


Reply via email to