Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Practical .NET Optimization Abuse

This is not abuse, it's intended behavior, standard library itself likes to use it a lot internally. That's also how generics work in Rust!

This can be pushed further by passing data by ref's. You can also easily allocate structs in unmanaged heap (aka malloc and free) and then pass them by `ref` without using unsafe (save for construction and alloc/free). Just don't do it for structs which contain gcrefs. C# can lean very heavily into systems programming :)

There have also been a large amount of struct optimizations across the last few versions. So it is not a coincidence that RyuJIT/ILC can trade blows with LLVM (not always but still!).

Edit: Oh god, I saw what this refers to. I take it back. There is likely a better, idiomatic and compiler-friendly way haha.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: