Xon
June 21, 2023, 11:18am
#1
Hello,
I had the occasion to install my project on different OS and a dozen of computers.
And I have remarked that the difference of loading time for sound buffers is really significant between MacOS (M1) and other OS (Linux or Windows), even though there are SSD hard drives.
On Mac OS, the loading time can be 3 or 4 quicker than with other OS (I can’t say exactly the ratio, but the difference is huge). Has anyone noticed this kind of difference when switching OS with buffer loading ? And can explain what is the reason, and if there is a way to improve the buffer loading time on OS different than MacOS ?
Manu thanks,
Best,
Christophe
This is known problem: Scheduling problems on Apple M1 · Issue #5948 · supercollider/supercollider · GitHub
There is already a fix, but I forgot to make a PR. Will do this week!
1 Like
Xon
June 21, 2023, 11:59am
#3
Many thanks,
But I think it concerns another issue.
Since what I have remarked is huge loading times on other OS than Mac M1, i.e. Windows and Linux, when you want to read hundreds of sound buffers on a server.
Ah sorry, I completely misread your issue!
Xon
June 21, 2023, 12:35pm
#5
No problem, I think the issue you mentioned is more important to fix! At least, my question allowed to remind this. Thanks anyway!
prko
June 21, 2023, 12:47pm
#6
I thought the time difference might be a machine specific phenomenon, but there seems to be an OS related reason that I could not assume. It is strange and interesting. I think this phenomenon is not easy to change. Currently, you should automate the process using a routine with s.sync
, I think.
Please refer to the benchmark results using the following code:
(
s.waitForBoot {
var timeFirst;
timeFirst = Process.elapsedTime;
100.do {
var timeEach;
timeEach = Process.elapsedTime;
Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
s.sync;
(Process.elapsedTime - timeEach).postln
};
("finished in" + (Process.elapsedTime - timeFirst) + "seconds.").postln
}
)
SC 3.13 on macOS 12.6.6 on Apple M1 Max Chip:
-> localhost
0.02148008300037
0.021489290999853
0.020935000000009
0.021624417000112
0.021055666999928
0.02188625000008
0.022673458999634
0.019927707999614
0.03158329200005
0.021636666000177
0.021069708000141
0.021115166000072
0.021482082999682
0.024802707999697
0.028415041999779
0.036863999999696
0.016987167000025
0.023682707999797
0.020762375000231
0.018942167000205
0.025277124999775
0.017976707999878
0.022261583000272
0.022482000000309
0.018624249999903
0.022115834000033
0.021234542000002
0.020730291999826
0.031741792000048
0.021680750000087
0.020948792000127
0.031984792000003
0.021640750000188
0.033366042000125
0.02006508300019
0.031544709000173
0.032322917000329
0.022500499999751
0.030633917000159
0.021454791999986
0.02546725000002
0.027690291999988
0.021678666999833
0.031599916000232
0.021243666999908
0.021276833000229
0.021523708000132
0.031969707999906
0.021216000000095
0.031929291999859
0.0215919999996
0.02817691700011
0.02562079099971
0.049592249999932
0.024562166999658
0.020693208000012
0.021194749999722
0.022676625000258
0.019876541000031
0.032787707999887
0.020486666000124
0.021428250000099
0.021168875000058
0.022326415999942
0.020417249999809
0.021001125000112
0.025980916000208
0.029469749999862
0.020855791000031
0.030543792000117
0.021204791999935
0.021993707999627
0.020598207999683
0.020952249999937
0.021419832999982
0.039057625000169
0.014134541000203
0.033365666000009
0.030919667000035
0.023137458000292
0.029715583000325
0.021851125000012
0.020806792000258
0.021519459000046
0.021165459000258
0.032160958000077
0.024062167000011
0.021730375000061
0.018835499999568
0.022392542000034
0.019304417000058
0.021166749999793
0.024414250000063
0.018211208000139
0.021366625000155
0.0229157079998
0.019271374999789
0.043389666000166
0.020218415999807
0.021676041999854
finished in 2.4216430830002 seconds.
SC 3.13 on macOS 10.14.6 on MBP 2018 (2.9 GHz Intel Core i9):
-> localhost
0.023149664999892
0.023281233000034
0.023265112999979
0.023140974999933
0.023159468999893
0.02317439400008
0.023239211999908
0.023135121999985
0.023278075999997
0.023250693999898
0.02312687299991
0.023235299999897
0.023244206000072
0.023138530000097
0.023232466000081
0.023180467999964
0.023164714000131
0.023286795999866
0.023119334000057
0.023320626999976
0.023148766999839
0.023246242000141
0.02305768899987
0.023234957999875
0.023268587000075
0.023188426999923
0.023190542000066
0.023155904000077
0.02317830700008
0.023226245999922
0.02322564200017
0.023183388999996
0.023232572000097
0.023173111999995
0.023235482000018
0.02320065899994
0.023180825999816
0.023199276000014
0.023160363999978
0.023257329999979
0.023181988000033
0.02319363100014
0.023221519000117
0.023232745999849
0.023170967999931
0.023258456000121
0.023177203999921
0.023250232000009
0.023164576999989
0.023216458999968
0.023191636000092
0.023192053000002
0.023288391999813
0.023099804999902
0.023203491999993
0.02321995200009
0.023177351999948
0.023139731999891
0.023214622000069
0.023193504000119
0.023247616000162
0.023157401999924
0.023357906999991
0.023091865999959
0.023160351000115
0.023230657999875
0.02317730499999
0.023227023000118
0.023676359999854
0.022795775999839
0.023129885999879
0.023195347999945
0.023244369999929
0.023145669000087
0.023205430999951
0.023262688999921
0.023149016999923
0.023280870999997
0.023138621999806
0.023186364999901
0.023274018999928
0.023156030000109
0.02321300299991
0.023183668000001
0.023232265999923
0.023208058999899
0.023234130999981
0.023205166000025
0.023130778999985
0.023674809000113
0.022776696999927
0.023210763000179
0.02325447599992
0.023124399999915
0.023236164000082
0.023220892000154
0.023230040000044
0.023123448999968
0.023243460000003
0.023157652000009
finished in 2.3218936879998 seconds.
SC 3.13 on Windows 11 via Parallels Desktop under macOS 12.6.6 on Apple M1 Max Chip:
-> localhost
0.023027958
0.027025250000008
0.029907583000011
0.021241041999986
0.028120250000029
0.029904875
0.020120707999979
0.029535709000015
0.029544209000051
0.01925516700004
0.031409000000053
0.018913041000019
0.029094332999989
0.032212665999964
0.01945362500004
0.024936458000013
0.025376666
0.030922707999991
0.028438792000031
0.021795333
0.029910124999958
0.019592750000015
0.028477875000021
0.030034709000006
0.019992915999978
0.029665540999986
0.021401041999979
0.029023833999986
0.029424209000013
0.020064624999975
0.028404875000035
0.031922209000015
0.019649707999974
0.028750750000029
0.021681999999998
0.026796832999992
0.032463457999995
0.020136332999982
0.028050249999978
0.032293374999995
0.016545832999952
0.032672875000003
0.021978499999989
0.025371666000012
0.024597749999998
0.03013712500001
0.023688083000025
0.025831707999998
0.028554166999982
0.022619209000027
0.027815083000007
0.029673375000016
0.02169674999999
0.028396083000018
0.029664249999996
0.01979074999997
0.030953749999981
0.028321791999986
0.018883249999988
0.030712375000007
0.020131916000025
0.027687415999992
0.031818708000003
0.019391208999991
0.028874500000029
0.031525250000016
0.019860707999953
0.029916415999992
0.020859624999957
0.022935457999949
0.027566957999966
0.029395792000003
0.030211957999995
0.019927915999972
0.029628875000014
0.019651167000006
0.030420708000008
0.029658707999999
0.020125249999978
0.029938707999975
0.029424499999948
0.01830966700004
0.031500957999981
0.01980104200004
0.026315791000002
0.033627625000008
0.019568583000023
0.02431933400004
0.030779790999986
0.024109791000001
0.029966124999987
0.020842833000017
0.030192291000048
0.020585083000014
0.030027708000034
0.030023916999994
0.018680125000003
0.031249500000001
0.029990166999994
0.019746458999975
finished in 2.611657208 seconds.
SC 3.13 on Windows 11 via Parallels Desktop under macOS 10.14.6 on MBP 2018 (2.9 GHz Intel Core i9):
-> localhost
0.042832400000009
0.031949300000008
0.020553500000005
0.031093800000008
0.018055199999992
0.029876099999996
0.026592800000003
0.026881299999999
0.027303500000002
0.023345399999997
0.032700899999995
0.015943800000002
0.032163400000002
0.017541499999993
0.030612599999998
0.031117899999998
0.021020900000011
0.031953400000006
0.019577799999993
0.029184200000003
0.020465899999991
0.029754499999996
0.03349399999999
0.021837700000006
0.0258228
0.02030160000001
0.033951400000007
0.026746900000006
0.02016110000001
0.030423800000008
0.021967200000006
0.029299599999987
0.030076000000008
0.022853900000001
0.017682100000002
0.032033499999997
0.029702299999997
0.020374899999993
0.030211999999992
0.021491999999995
0.027797800000002
0.020791500000001
0.030007800000007
0.030482200000009
0.019561199999998
0.031506100000001
0.01934270000001
0.0643642
0.047933499999999
0.031779200000003
0.026023699999996
0.020585999999994
0.0303167
0.018982399999999
0.031518200000008
0.026723099999998
0.021112599999995
0.027657500000004
0.032746399999994
0.025735900000001
0.024182400000001
0.017689799999999
0.023513099999988
0.050238100000001
0.032457500000007
0.027472599999996
0.020593500000004
0.028811199999993
0.030400600000007
0.023002000000005
0.017821099999992
0.028115099999994
0.026421899999988
0.023922299999995
0.025935700000005
0.032487500000002
0.021735099999987
0.028163199999995
0.016859700000012
0.034451900000008
0.027113199999988
0.023790900000009
0.021631299999996
0.02114379999999
0.028522100000004
0.031419699999987
0.019348400000013
0.028967699999995
0.017318100000011
0.028275899999997
0.031302499999995
0.018684500000006
0.0296053
0.023130899999998
0.024176799999992
0.03199149999999
0.020767300000003
0.026246500000013
0.035426600000008
0.015709199999989
finished in 2.6912457 seconds.
SC 3.11.2 on Ubuntu 22.04 via Parallels Desktop under macOS 12.6.6 on Apple M1 Max Chip:
-> localhost
0.043760873988504
0.042891665012576
0.042771581996931
0.042457164992811
0.042322040011641
0.043058832001407
0.043174332007766
0.04227420699317
0.042749497981276
0.043161373003386
0.043138540990185
0.042833123006858
0.04242987401085
0.043458206986543
0.042674914991949
0.043351041007554
0.043024582002545
0.04274137399625
0.04295862300205
0.043264872976579
0.042248582001776
0.042778998991707
0.043068081984529
0.042485915008001
0.043367039994337
0.043123498995556
0.042344206973212
0.04314466600772
0.04289804000291
0.043352831999073
0.043650790001266
0.04146399901947
0.044220498995855
0.041083581978455
0.044915831997059
0.041288164997241
0.043830373993842
0.043592748988885
0.041691207006807
0.04392258200096
0.042927247995976
0.043804665008793
0.042044957022881
0.043422082002508
0.042965123982867
0.043170082004508
0.040801791008562
0.045405582000967
0.041153541009407
0.044306082010735
0.040833206992829
0.045205164991785
0.042843206989346
0.040432581998175
0.044711581984302
0.044590664998395
0.043006415013224
0.043166415009182
0.042586290015606
0.042836165986955
0.043142456997884
0.04110779101029
0.045420207025018
0.069497747987043
0.040104665007675
0.044394332013326
0.043353248009225
0.041454207006609
0.039423706999514
0.045344665006269
0.043728540011216
0.04218487298931
0.043044040008681
0.03894762400887
0.045181540015619
0.03998458199203
0.04423983101151
0.043264164996799
0.041179372987244
0.043456207000418
0.044163623999339
0.04311038099695
0.041911429987522
0.03948625799967
0.045649122010218
0.041805079992628
0.042101634986466
0.04509271401912
0.042800300987437
0.043133222003235
0.042223105992889
0.042026776995044
0.041969290992711
0.044482650002465
0.041898933006451
0.042382693005493
0.042865953000728
0.042517160996795
0.042713779985206
0.041462619992672
finished in 4.3115591050009 seconds.
SC 3.11.2 on Ubuntu 22.04 via Parallels Desktop under macOS 10.14.6 on MBP 2018 (2.9 GHz Intel Core i9):
-> localhost
0.043769009000002
0.042360300999988
0.042878657000003
0.042829931999989
0.043008475999997
0.042516978000009
0.044251568000007
0.041982672999993
0.042640016999997
0.043289608000009
0.043054947999991
0.042486596000003
0.044284891000004
0.041507967000001
0.04320306599999
0.04323085
0.042789882000008
0.043423910000001
0.043354789999995
0.041969203999997
0.043295869000005
0.045297824999992
0.043287809000006
0.040782854
0.042239744
0.043502047999993
0.042308301000006
0.199619125
0.043754664999994
0.040547812
0.042051838000006
0.042487137999998
0.042945080999999
0.042368320000008
0.042667140000006
0.042623767999999
0.042529717000008
0.042711373000003
0.042596133000004
0.048212570000004
0.037062106999997
0.043256674999995
0.043730666999991
0.041025496000003
0.042618537999999
0.043993303999997
0.041206691999989
0.042924512999988
0.042716663999997
0.042535271999995
0.043012009000009
0.042379124000007
0.045269134000009
0.040925552999994
0.042760178999998
0.042297528000006
0.043056635999989
0.046283752999997
0.039576679000007
0.043306489000003
0.042567727000005
0.042215604000006
0.04271347800001
0.042914464999996
0.042982497000011
0.043317706000011
0.045051549999997
0.039678661000011
0.043589459000003
0.042467129000002
0.042481164000009
0.043089882000004
0.042412252000005
0.043807049999998
0.042208823999999
0.043488443999991
0.041780220000007
0.045777537000006
0.039958525000003
0.043275323999993
0.042192387999989
0.043518763999998
0.042736036999997
0.042652482999998
0.044469809999995
0.041668900999994
0.042897248999992
0.042047697000001
0.043157562000005
0.043150560000001
0.043125695000001
0.044001202000004
0.040782925000002
0.043544467000004
0.046238101
0.038998711999994
0.042841465000009
0.042671138999992
0.044720316999999
0.041311434999997
finished in 4.441111741 seconds.
@prko I think what you are measuring here is not buffer loading time, but the client → server → client round-trip time for asynchronous commands.
After all, the WAV file is tiny and already cached by the OS. What results do you get if you remove the Buffer.read
call?
If you really think that the file I/O is slow, you need to test with large files. Ideally, each file should be newly created to avoid any caching.
prko
June 21, 2023, 2:56pm
#8
Ah… yes! I was wrong. What would be the best way to measure the buffer load time? The following code does not seem to work either:
(
s.waitForBoot {
var timeStart;
timeStart = Main.elapsedTime;
100.do {
Buffer.read(
s,
Platform.resourceDir +/+ "sounds/a11wlk01.wav",
action: { (Main.elapsedTime - timeStart).postln }
)
};
}
)
Benchmark the code once with Buffer.read
and once without Buffer.read
. The difference will be the actual time spent for buffer reading.