arcadia-unity / ArcadiaGodot

Other
178 stars 14 forks source link

instancing 3d nodes off the main thread (in repl) is slow #14

Open selfsame opened 3 years ago

selfsame commented 3 years ago

looks like this will get fixed with the vulcan renderer: https://github.com/godotengine/godot/issues/36793

Alternately, we could consume REPL forms in the main thread.

selfsame commented 3 years ago

fixed with 5b46bc4b711c3e6932ecf02911b4737629f2be7b

I'm happy with this hack,: using arcadia.core/timeout for tooling evals/loadfile to get into the main thread

selfsame commented 3 years ago

Re-opening this since the NRepl main-thead-eval wasn't working (see #20)

kdlee commented 2 years ago

To me seems like it's not just slow, but calling instance() from a thread also appears to have stability issues. Using Godot 3.3, I'm getting crashes from places like below, even with RENDER_SEPARATE_THREAD mode set in the project. Seems like calling instance() from a thread maybe isn't fully fleshed out yet ...

StringName::operator<(const StringName & p_name) Line 100 (godot\core\string_name.h:100) Comparator::operator()(const StringName & p_a, const StringName & p_b) Line 292 (godot\core\typedefs.h:292) Map<StringName,StringName,Comparator,DefaultAllocator>::_find(const StringName & p_key) Line 241 (godot\core\map.h:241) Map<StringName,StringName,Comparator,DefaultAllocator>::find(const StringName & p_key) Line 533 (godot\core\map.h:533) Shader::remap_param(const StringName & p_param) Line 92 (godot\scene\resources\shader.h:92) ShaderMaterial::_get(const StringName & p_name, Variant & r_ret) Line 141 (godot\scene\resources\material.cpp:141) ShaderMaterial::_getv(const StringName & p_name, Variant & r_ret) Line 78 (godot\scene\resources\material.h:78) Object::get(const StringName & p_name, bool r_valid) Line 516 (godot\core\object.cpp:516) Resource::duplicate_for_local_scene(Node p_for_scene, Map<Ref,Ref,Comparator<Ref>,DefaultAllocator> & remap_cache) Line 167 (godot\core\resource.cpp:167) SceneState::instance(SceneState::GenEditState p_edit_state) Line 246 (godot\scene\resources\packed_scene.cpp:246) PackedScene::instance(PackedScene::GenEditState p_edit_state) Line 1706 (godot\scene\resources\packed_scene.cpp:1706)

selfsame commented 2 years ago

@kdlee ah yeah that's unfortunate,

I've heard that instancing in threads will be better supported in Godot 4, but in the mean time if you use the UDP or Socket Repls they will eval on the main thread (https://github.com/arcadia-unity/ArcadiaGodot/blob/master/Source/arcadia/repl.clj#L256)