Lag spikes when updating UI elements

GodotSteam MP build 4.2.2 stable - linux64 s159 gs48


I am trying to make a coin total display, I make a Control-based scene, with a Spinbox (used to be a Label, but I tried a Spinbox to see if that was the source of my woes…)

The whole thing is functional, but I get lag spikes when the value changes, be it with a tween or even just directly changing the value

Here are the frame times without changing the spinbox

As you can see without changing the spinbox the biggest spike I have is from the character process while breaking the pot, and it stays under 16ms, but when I change the value of the spinbox …

Not only there is a spike, but the profiler can’t tell me where it’s from :frowning:

The spinbox update function:

var _disp_money: int = 0
func refresh_money_display():
	if _disp_money !=
		_disp_money =
		var tween: Tween = get_tree().create_tween()
		tween.tween_property(money_spinbox, "value",, 1).set_trans(Tween.TRANS_BOUNCE)

The method is called from a Timer node, every second on timeout
RunData is a global auto-load

The UI scene:

I am kind of clueless as to what I’m doing wrong here, any idea appreciated

Thanks in advance :v:

I know this looks nonsensical and unrelated, but removing the refresh_money_display() solves all lag spikes I am experiencing, and the spike without info on the profiler syncs up with the refresh …

Turns out I was very tired when I tested this …

The issue was with the pot breaking, and the overhead of the refresh money function just made it more visible (I still don’t know why the profiler does not know the function stack)