[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-users] MIDI sensory overload?
Would you mind posting the code? Or a simplified version ... you're right that we probably won't be able to reproduce the problem without similar hardware, but I'm curious to see if there are any places where it would be possible to squeeze out some more efficiency from the sc code.
One suggestion I can make offhand is that Dictionary is pretty slow. IdentityDictionaries are faster, and Arrays are even faster than that. Since MIDI controllers have integer IDs, Array would be the best to use.
d = Dictionary.new;
50.do({ |i| d.put(i, i) });
bench { 100000.do({ d[50.rand] }) };
time to run: 2.478631702 seconds.
d = IdentityDictionary.new;
50.do({ |i| d.put(i, i) });
bench { 100000.do({ d[50.rand] }) };
time to run: 0.452143546 seconds.
d = Array.newClear(50);
50.do({ |i| d.put(i, i) });
// or d = (0..49);
bench { 100000.do({ d[50.rand] }) };
time to run: 0.29954760699999 seconds.
That's an eightfold speed increase over Dictionary.
hjh
On Tuesday, Dec 28, 2004, at 19:25 US/Eastern, nescivi wrote:
when working on my performance (and unfortunately also while doing the
performance :( ) I noted a problem with the MIDIIn triggering some
routines and sending messages to the server.
____________________________________
H. James Harkins /// dewdrop_world
http://www.dewdrop-world.net
"If attacked by a lion, thrust your arm down his throat.
This takes some practice." -- Cyril Connolly