I’ve recently discovered this project, which assuming it works as advertised (which I think wasn’t really tested yet, since it seems to be a pretty new repo) sounds like a pretty good library to add into your toolbox.

For those that do not know, LINQ is basically a query language over collections in C#, that allows you (from the top of my head) to do stuff like

someList.Where(x => x.value < 10).OrderBy(x => x.priority).Select(x => x.name)

which would give you a IEnumerable list with names of elements where value is smaller than 10, ordered by priority.

However, using LINQ in performance critical code, such as per-frame Updates, is not really a good idea because it unfortunately does generate a lot of garbage (allocations for GC to collect). Having a version that doesn’t allocate anything sounds awesome, assuming you are a fan of LINQ.

What are your thoughts? For me, it sounds like something really useful. While it’s not really that difficult to avoid LINQ, I’m a fan of the simplicity and descriptive nature of the syntax, and not having to avoid it would be great. It does seem there are quite a few issues starting to pop up, but it’s definitely a project that could be worth it to follow.

  • josefo@leminal.space
    link
    fedilink
    arrow-up
    1
    ·
    6 days ago

    Kissaki provided a neat list. Of those I’ve used UniTask extensively and is a game changer. It’s a must have if you are using threading, as it forces single threads on platforms where is unavailable, without compromising performance in the others. We have a game on iOS and Android, with a lot of threading work involved to load bazillions of things, but webgl doesn’t support threads, so adding it as a platform presented an interesting challenge. Switching our threading to UniTask instead of native Tasks makes it possible to not change our code or having weird #if UNITY_WEBGL flags scattered around virtually everywhere to toggle threading. And the zero allocation tasks are awesome. And it has a lot of interop and extensions to neatly integrate with Unity better than the native tasks, while not breaking the native interface.