Low performance on new PC

Checked the SuperCollider scsynth.log from a typical 6sec crushing session:

  • location on Win10: C:\Users\<user>\.sonic-pi\log\scsynth.log
  • starts with
late 0.004591465
late 0.009077072
late 0.000503063
late 0.026629448
late 0.052752018
late 0.031120300
  • ends 118 late messages later with:
...
late 0.615797043
late 0.641923428
late 0.607231617
late 0.633355618
late 0.659476757

At this time the traceback in SP UI is:

C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/lang/core.rb:4057:in `sleep'
workspace_seven:16:in `block (4 levels) in __spider_eval'
workspace_seven:7:in `times'
workspace_seven:7:in `block (3 levels) in __spider_eval'
C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/lang/core.rb:2194:in `block in live_loop'
C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/lang/core.rb:2214:in `block (2 levels) in live_loop'
C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/lang/core.rb:2134:in `block (2 levels) in loop'
C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/lang/core.rb:2355:in `block_duration'
C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/lang/core.rb:2392:in `block_slept?'
C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/lang/core.rb:2133:in `block in loop'
C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/lang/core.rb:2131:in `loop'
C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/lang/core.rb:2131:in `loop'
C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/lang/core.rb:2212:in `block in live_loop'
C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:1042:in `block (2 levels) in __in_thread'

which seems to mean that it is more than the current_sched_ahead_time (0.5s default) behind schedule.

Maybe this details helps documenting the issue?

Not really - it’s exactly just what I’d expect to see from a system that’s not able to keep up with what it’s been asked to do. It’s slowly getting further and further behind until it’s too far and Sonic Pi gives up and kills the thread.

What’s the code you’re running to reproduce this?

I was running the code from @chris.krakou original post.

And I cannot see a big difference between AMD and Intel, just tested on my notebook:

  • WIn 10 PRO
  • i7-6820HK (not the newest, but was quite a beast a few years ago)
  • 32GB
    failed in ~5sec too

OK, so I tested this on 3 of my machines now and found 1 that exhibits this behaviour, so that’s something. It worked just fine on my powerful PC tower, on my tablet but not on my old ASUS UX301LAA which has an i7-4500U CPU.

I also managed to reduce the code that triggers this down to:

loop do
  4.times do
    synth :dsaw, release: 0.1, note: :e3
  end
  sleep 0.125
end

I’ll investigate further…

Update, I just installed v3.1 of Sonic Pi using the portable installer and this code works just fine.

This is definitely something we should be able to fix.

Could you verify that the issues you’re having are not present within v3.1?

Installed 3.1.0 portable on my Intel notebook and it runs longer than on 3.2.2, but still starts to stutter after 5sec and fails after ~11sec.

I just installed 3.2 on my poorly performing Windows laptop and that ran just fine.

I think I know what might be causing it and unfortunately it’ll be non-trivial to fix, but I’ll give it a go.

Still, I can’t explain why it’s not working with v3.1 for you :frowning:

Saw now your minimum test-case and that

  • starts to stutter after ~4sec and
  • fails after ~7sec

Hi Sam,

Just ran your code on my OLD i7 PC.

Win Pro 10.
SP 3.2.0
16G Mem.
i7 860 @ 2.8 Ghz.

Got bored listening to it after 15 mins with no glitches…

Extra info always helps.

Eli…

I think I know what might be causing it and unfortunately it’ll be non-trivial to fix, but I’ll give it a go.

nice, and all the best!

Still, I can’t explain why it’s not working with v3.1 for you :frowning:

How important is in your opinion the soundcard, which is maybe the weak part on my desktop and notebook?

Pretty sure it’s not the sound card that’s causing this issue - although I may be wrong.

1 Like

Thanks for this! Did you also try it with v3.2.2 and get glitches?

If you get no glitches in either, what’s the maximum value you can put in the n.times iteration before you do get glitches for both v3.2 and v3.2.2?

ok, this is pretty obscure, but could someone that’s experiencing these issues please install the latest Microsoft C++ redistributable from here:

https://aka.ms/vs/16/release/vc_redist.x64.exe

and then try again?

26.times do <- on 3.2.0

26.times do <- on 3.2.2

Eli…

Hello again.

It’s been a while and I’ve been super busy with work (grading 150 student assignments in two weeks does that to you), and when I tried just now, the issue is gone. I tried downloading the 3.1 and 3.2.2 portables, and they showed no issues. Intrigued, I tried my install again, and the issue is gone. I have no idea how. The vc_redist.x64.exe library(?) is installed on my system, probably by a game. I have also installed the automatic updates since then: this one and this one. I will try removing the redist and see if that replicates the issue.

EDIT: Nope, uninstalling the redistributable didn’t break Sonic Pi (running the code at 1000 bpm. It breaks at 1500 bpm). Guess it must have been something in an update or something. Very mysterious.

EDIT 2: Nope, still messes up. But not all the time

I’ve just installed that C++ redistributable and restarted, but the problem remains the same for me.

So odd. I really don’t know what the issues are. Especially if you get the same behaviour on v2.1

I’m guessing you mean v3.1? Because I’m not even sure how to get v2.1 now.
I just downloaded and installed v3.1 portable, and I get the same behaviour - it dies after just over 7 seconds using your reduced code.

Okay, new development. I sat down to practise a bit just now, and the issue is back. It seems like it’s one of those bugs you can’t track down completely.I still haven’t done my complete re-install so it’s a windows home edition to begin with. I’ll see to it this weekend (pinky promise)

It’s definitely a slippery thing indeed.

The fact that it works/doesn’t work differently on different setups and that there’s no consistency across different versions of Sonic Pi back to 3.1 makes this pretty much impossible to understand.

The only constant appears to be that this only exhibits itself on Windows.

If anyone has any expertise at looking under the hood of Windows applications I’d love any help shedding any light on this matter…