If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Ruby Speed Question
9 posts
• Page 1 of 1
Ruby Speed Question
Myco pointed out before that If i use multiple ruby outs, FS would be faster on one link.
So if i have all the outs on one output like this...is FS still faster?...
I presuming that "parse" means loosly to "push the data"...
So what happens here on this link....any delay for parsing???....
or do all receiving inputs get exactly the same signal.
I guess in a way I'm trying to "eliminate" trigger order........
Here's the original question...
Is it better off to take something like this...
And turn it into this....
So who's faster..Ruby or FS
Myco:
The FS version is faster, because every trigger on a Ruby input invokes the Ruby parser/interpreter, which is slower than native machine code.
So if i have all the outs on one output like this...is FS still faster?...
I presuming that "parse" means loosly to "push the data"...
So what happens here on this link....any delay for parsing???....
or do all receiving inputs get exactly the same signal.
I guess in a way I'm trying to "eliminate" trigger order........
Here's the original question...
Is it better off to take something like this...
And turn it into this....
So who's faster..Ruby or FS
Myco:
The FS version is faster, because every trigger on a Ruby input invokes the Ruby parser/interpreter, which is slower than native machine code.
BV MUSIC SYDNEY AUSTRALIA..Songwriting and Software development
Headquartershttps://www.bvmusicsydneyaustralia.com/
Spotifyhttps://open.spotify.com/artist/7JO8QM40mVmHb7pAwKPJi0
Donatationhttps://www.paypal.com/donate/?hosted_button_id=HEUR8R7K8GZ4L
Headquartershttps://www.bvmusicsydneyaustralia.com/
Spotifyhttps://open.spotify.com/artist/7JO8QM40mVmHb7pAwKPJi0
Donatationhttps://www.paypal.com/donate/?hosted_button_id=HEUR8R7K8GZ4L
- billv
- Posts: 1157
- Joined: Tue Aug 31, 2010 3:34 pm
- Location: Australia
Re: Ruby Speed Question
Though I can't directly provide any answer ... I thought I recall a 'timing' module that might have been designed to test the execution time of a routine.
Might have been something from TROG's toolkit, or maybe MyCo's utility [?].
This may have been from the SM forum.
Just an idea ...
Might have been something from TROG's toolkit, or maybe MyCo's utility [?].
This may have been from the SM forum.
Just an idea ...
- RJHollins
- Posts: 1571
- Joined: Thu Mar 08, 2012 7:58 pm
Re: Ruby Speed Question
why not using wireless links? and does this make a difference? are there linkorder on wireless links too?
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
Re: Ruby Speed Question
Nubeat7 wrote:are there linkorder on wireless links too
I'm pretty sure there is...(correct if wrong)
.......you can see the linkorder using the new "TAB" feature on wireless links....
BV MUSIC SYDNEY AUSTRALIA..Songwriting and Software development
Headquartershttps://www.bvmusicsydneyaustralia.com/
Spotifyhttps://open.spotify.com/artist/7JO8QM40mVmHb7pAwKPJi0
Donatationhttps://www.paypal.com/donate/?hosted_button_id=HEUR8R7K8GZ4L
Headquartershttps://www.bvmusicsydneyaustralia.com/
Spotifyhttps://open.spotify.com/artist/7JO8QM40mVmHb7pAwKPJi0
Donatationhttps://www.paypal.com/donate/?hosted_button_id=HEUR8R7K8GZ4L
- billv
- Posts: 1157
- Joined: Tue Aug 31, 2010 3:34 pm
- Location: Australia
Re: Ruby Speed Question
Which is faster - well, that's very likely to depend on what you are trying to do and which components you are using - but MyCo is right, Ruby is not a 'silver bullet' for better performance.
First a couple of answers to the direct questions...
What is parsing?
'Parsing' is the act of taking the written code and translating into actual machine instructions. The difference is most clear if you compare Ruby to DSP code or assembly...
For DSP code and assembly, the code gets 'compiled' - actually turned into a complete set of machine instructions - and those instruction just get executed without FS having to ever look at the written code again (until you change it!). So compiled code is parsed, but only once, and "off line" long before the code actually runs.
In contrast, Ruby actually processes your written instructions at run time - turning them afresh into machine commands each time around. Well, it is a little cleverer than that - it uses something called 'byte-code'. Rather than always having to scan the actual characters you write down, it turns words that it knows are commands into 'codes' to speed up the execution, and similarly for 'symbols' such as variable names. But it is still a much slower process than simply running a chunk of ready compiled machine instructions.
Within a primitive, of course, everything is already compiled by DSPr, so there is no parsing at all - and they can dig inside the CPU instructions much deeper than we can, so primitives can be very optimised.
Do wireless have a trigger order?
Yes, but it is much, much harder to manage than for 'spaghetti' links. The order is decided by the order that you build the links, and once built, the only way to change it is to delete them and rebuild! IMHO, they are best used for 'preference' type settings that won't change much, or as single links to reach hard to get places.
Re: Speed comparison...
In the case of the examples above, I would guess that the 'speed' order would be something like...
Fastest - Just splitting the green trigger - there's no translation from 'green' to 'Ruby' and back again, and no parsing.
Medium Fast - Single 'green' Ruby output - there's only one translations Ruby->green, and then the trigger goes on its merry way. The version where it is a single 'Ruby value' output would only be used if you were sending the signal only to other Ruby components - if each one needed turning back into green later on, it would be very slow.
Slowest - Ruby with many trigger outputs. All of those 'output,x,y' lines need parsing individually, and then every output needs translating back into green - again one at a time. You should only do this if the outputs really do represent independent signals that happen under different circumstances, and there is some reason that you must use Ruby to get the code working.
An example of where Ruby might be faster is when you are working on very large arrays or complex data structures - Ruby has many array operations that can be done with just a single command (e.g. sorting and filtering), where 'green' would need dozens of components, all contributing to a massive number of triggers to look after. But even then, it's not guaranteed that Ruby would be faster, it will depend on the complexity of the operation, and how good you are at optimising green triggers (using 'trigger blockers etc.)
If accurate timing is more important than CPU load, then naturally, you should use Ruby for its sample locked clock - and there are some things Ruby can do that would be nearly impossible in 'green'!
One time that you should ALWAYS heed MyCo's advice is when there is a something you need to do in 'green', and it can be done using just a handful of primitives. Ruby will be WAY slower than the compiled code inside a primitive, and translating green->Ruby->green will just slow it down even more.
First a couple of answers to the direct questions...
What is parsing?
'Parsing' is the act of taking the written code and translating into actual machine instructions. The difference is most clear if you compare Ruby to DSP code or assembly...
For DSP code and assembly, the code gets 'compiled' - actually turned into a complete set of machine instructions - and those instruction just get executed without FS having to ever look at the written code again (until you change it!). So compiled code is parsed, but only once, and "off line" long before the code actually runs.
In contrast, Ruby actually processes your written instructions at run time - turning them afresh into machine commands each time around. Well, it is a little cleverer than that - it uses something called 'byte-code'. Rather than always having to scan the actual characters you write down, it turns words that it knows are commands into 'codes' to speed up the execution, and similarly for 'symbols' such as variable names. But it is still a much slower process than simply running a chunk of ready compiled machine instructions.
Within a primitive, of course, everything is already compiled by DSPr, so there is no parsing at all - and they can dig inside the CPU instructions much deeper than we can, so primitives can be very optimised.
Do wireless have a trigger order?
Yes, but it is much, much harder to manage than for 'spaghetti' links. The order is decided by the order that you build the links, and once built, the only way to change it is to delete them and rebuild! IMHO, they are best used for 'preference' type settings that won't change much, or as single links to reach hard to get places.
Re: Speed comparison...
In the case of the examples above, I would guess that the 'speed' order would be something like...
Fastest - Just splitting the green trigger - there's no translation from 'green' to 'Ruby' and back again, and no parsing.
Medium Fast - Single 'green' Ruby output - there's only one translations Ruby->green, and then the trigger goes on its merry way. The version where it is a single 'Ruby value' output would only be used if you were sending the signal only to other Ruby components - if each one needed turning back into green later on, it would be very slow.
Slowest - Ruby with many trigger outputs. All of those 'output,x,y' lines need parsing individually, and then every output needs translating back into green - again one at a time. You should only do this if the outputs really do represent independent signals that happen under different circumstances, and there is some reason that you must use Ruby to get the code working.
An example of where Ruby might be faster is when you are working on very large arrays or complex data structures - Ruby has many array operations that can be done with just a single command (e.g. sorting and filtering), where 'green' would need dozens of components, all contributing to a massive number of triggers to look after. But even then, it's not guaranteed that Ruby would be faster, it will depend on the complexity of the operation, and how good you are at optimising green triggers (using 'trigger blockers etc.)
If accurate timing is more important than CPU load, then naturally, you should use Ruby for its sample locked clock - and there are some things Ruby can do that would be nearly impossible in 'green'!
One time that you should ALWAYS heed MyCo's advice is when there is a something you need to do in 'green', and it can be done using just a handful of primitives. Ruby will be WAY slower than the compiled code inside a primitive, and translating green->Ruby->green will just slow it down even more.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
Re: Ruby Speed Question
In other words: don't make dummy ruby trigger pass through, otherwise you loose 0.000000000000000000000000001% of your CPU speed.
Generally, the performance questions should probably placed in a context. "Ruby in context of", otherwise you may get answers like above?
Generally, the performance questions should probably placed in a context. "Ruby in context of", otherwise you may get answers like above?
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Feel free to donate. Thank you for your contribution.
- tester
- Posts: 1786
- Joined: Wed Jan 18, 2012 10:52 pm
- Location: Poland, internet
Re: Ruby Speed Question
trogluddite wrote:First a couple of answers to the direct questions.
Thanks trog.....lots of details to think about there.....
trogluddite wrote:Fastest - Just splitting the green trigger - there's no translation from 'green' to 'Ruby' and back again, and no parsing.
Look up in the sky, is it a bird, is it a plane....no it's Supergreen......da da dada da da da
tester wrote:Generally, the performance questions should probably placed in a context.
Yeh...I'm bad...sorry.........there's just so many different context here......
tester wrote:otherwise you may get answers like above?
Was a great answer though......Trog can still see through my dodgy questions....
Ok, here's a context...
There should be no delays with something like this...yes????
BV MUSIC SYDNEY AUSTRALIA..Songwriting and Software development
Headquartershttps://www.bvmusicsydneyaustralia.com/
Spotifyhttps://open.spotify.com/artist/7JO8QM40mVmHb7pAwKPJi0
Donatationhttps://www.paypal.com/donate/?hosted_button_id=HEUR8R7K8GZ4L
Headquartershttps://www.bvmusicsydneyaustralia.com/
Spotifyhttps://open.spotify.com/artist/7JO8QM40mVmHb7pAwKPJi0
Donatationhttps://www.paypal.com/donate/?hosted_button_id=HEUR8R7K8GZ4L
- billv
- Posts: 1157
- Joined: Tue Aug 31, 2010 3:34 pm
- Location: Australia
Re: Ruby Speed Question
billv wrote:Ok, here's a context...
...I didn't explain the "context' at all did I....?
Idea with above picture is for splitting up the "bool to false' trigger from the stop/start.
My synth relies heavily on this "bool to false' trigger....
Won't help for standalone but could tighten this area up for VST....
BV MUSIC SYDNEY AUSTRALIA..Songwriting and Software development
Headquartershttps://www.bvmusicsydneyaustralia.com/
Spotifyhttps://open.spotify.com/artist/7JO8QM40mVmHb7pAwKPJi0
Donatationhttps://www.paypal.com/donate/?hosted_button_id=HEUR8R7K8GZ4L
Headquartershttps://www.bvmusicsydneyaustralia.com/
Spotifyhttps://open.spotify.com/artist/7JO8QM40mVmHb7pAwKPJi0
Donatationhttps://www.paypal.com/donate/?hosted_button_id=HEUR8R7K8GZ4L
- billv
- Posts: 1157
- Joined: Tue Aug 31, 2010 3:34 pm
- Location: Australia
Re: Ruby Speed Question
tester wrote:In other words: don't make dummy ruby trigger pass through, otherwise you loose 0.000000000000000000000000001% of your CPU speed.
He he
But remember also what MyCo mentioned a little while ago...
Because Ruby and Green are of different threads, there is also a time cost for translating Green->Ruby->Green - around 1ms per 'translation' - of much more significance than a small CPU increase.
...and that was from a conversation he had with Malc, so likely much more accurate that my wild guesswork!!
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
9 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 74 guests