why fps is droping when instancing a scene which contains one spatial node?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By rhl

hi,

i am doing some performance test and i have a main scene and a spatial scene which contains only one default spatial node and no script.

if i create a prefab contains a gameObject in Unity Engine and when attach this script on scene, i’m getting 60 constant fps even there is 160k game object in the scene.

but if i create this scene with Godot i’m getting 8-11 fps even there is only 10k spatial scene. so when try instantiate 160k spatial scene, Godot is crashing.

here is my unity c# code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class scr : MonoBehaviour {

public GameObject empty;
public int count = 0;
public float fps;
private float deltaTime;

void Start () {
	for(int x=-200; x<200; x++){
		for(int y=-200; y<200; y++){
			Instantiate(empty);
			empty.transform.position = new Vector3(x,y,0);
			count++;
		}
	}
}

// Update is called once per frame
void Update () {
	deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
	float f = 1.0f / deltaTime;
	fps = Mathf.Ceil(f);
}
}

and here my gdscript code;

extends Node

export (PackedScene) var spatial_scene
var count = 0

func _ready():
for x in range(-50,50):
	for z in range(-50,50):
		var v = spatial_scene.instance()
		v.translate(Vector3(x,0,z))
		add_child(v)
		count += 1
pass

func _process(delta):
OS.set_window_title("Test" + " | Fps: " + str(Engine.get_frames_per_second()))
pass

so, i dont understand what i am missing?

thanks.

Can you share more info about your machine ?
OS, CPU, GPU… ?

Also is it possible to share the Godot project (version 3.x+) ?

GameVisitor | 2018-08-25 08:03

Godot 3.0.6
CPU G3258
GPU R9270

i don’t think that is nessesary. because its a comparision. let forget empty scenes or prefabs. if i want only create a node from scrpit the result became same.

in unity 40k cube object = 17 fps
In godot 6k empty node which is created by Node.new() = 1fps, if i want more node then godot is crashing.

i dont understand that what is in empty node is working on cpu ? I have not even filled these nodes with mesh or textures etc.

thanks for answering.

rhl | 2018-08-25 09:18

Since there doesn’t seem to be anything wrong in your gdscript, it might be because Godot is picking the wrong GPU ?

In case it helps: https://forum.godotengine.org/32257/how-can-i-force-editor-to-use-correct-gpu

Make sure the console on editor startup is displaying the R9270

GameVisitor | 2018-08-26 14:20