Neroware / GodotRx

Reactive Extensions for Godot Engine version 4
MIT License
94 stars 6 forks source link

Handling threads is solved in a convoluted and bad way #5

Closed Neroware closed 1 year ago

Neroware commented 1 year ago

The StartableThread is a class extending the StartableBase interface. When a new thread is launched, it stores its instance in a dictionary, mapping thread ID to Thread instance and vice versa. This way, threads are managed and never die before they have finished their callback. However, wait_to_finish() is currently called in a very bad manner. A scheduler just checks in intervals, which instances have finished execution and then joins them. This is very bad for performance. A better version is already in NativeGodotRx!

Ifhay commented 1 year ago

Sorry but what does this mean for GodotRx users? I see that NativeGodotRx has a few definitions that GodotRx already has — Observable, Scheduler, etc. Should GodotRx users add NativeGodotRx GDExtension and replace all parent classes in this addon with the ones from the native one?

Neroware commented 1 year ago

G'Day! The simple answer: No, the native version is a separate project. The creation and joining of Godot-Threads is handled differently there. That is why I brought it up in the first place.

Some additional information:

The faster NativeGodotRx version (already way faster than RxPY) is currently not yet public. I think you saw my abandoned repo. I still have around 60 ops to port but it will become public soon! Afterwards, I will update this version but NativeGodotRx is my current focus.

Neroware commented 1 year ago

Fixed with 4.1 rewrite!