FusionCache icon indicating copy to clipboard operation
FusionCache copied to clipboard

[FEATURE] 🪞 Remove all usage of reflection

Open jodydonetti opened this issue 1 year ago • 1 comments

Problem

Not technically a problem per se, but with the release of the new and improved auto-recovery in v0.24.0, I had to add a little bit of reflection usage to support a complex scenario of recovering some of the transient distributed errors scenarios.

Solution

I'd like to look back at that code and find a way remove reflection, mainly to:

  • improve performance
  • be better positioned for, eventually, playing with AOT (where reflection is basically a no-go)

jodydonetti avatar Feb 09 '24 16:02 jodydonetti

Hi all, I just released v1.0.0-preview1 🥳

Please try it out so we can spot any potential issue before the official v1.0, thanks!

jodydonetti avatar Feb 11 '24 19:02 jodydonetti

I see some usages of lock in the code, have you though about using Lazy<T> where possible? For example, FusionCache.cs / AutoRecovery uses a lock to generate if it doesn't exist, would it be more performance to use a lockless style instead?

celluj34 avatar Feb 19 '24 15:02 celluj34

Hi @celluj34 , I think it has an overhead over a simple double-checked lock, but I'll try asap and will let you know.

Anyway, take a look at Lazy<T> implementation...

jodydonetti avatar Feb 19 '24 16:02 jodydonetti

Oh lol I never knew it used a lock under the hood. Well nevermind then! I always thought Lazy<T> was a good way to avoid locks in app code since they are blocking, but I guess it's locks all the way down...

celluj34 avatar Feb 20 '24 00:02 celluj34

Hi all, I just released preview2 🥳

Please give it a try, thanks!

jodydonetti avatar Feb 23 '24 22:02 jodydonetti

Hi all, I've finally released v1.0 🥳

Feels a little unreal tbh, but yep: v1.0 is out.

jodydonetti avatar Mar 01 '24 08:03 jodydonetti