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
What is better?
10 posts
• Page 1 of 1
What is better?
Hi all. When I made some own modules, I often got several ways to get the same results. Finally I choose the one that spends less CPU cycles or RAM or another efficiency feature. Sometimes I can´t to see which ones spend less of that charges.
If anyone has the same problem that me, I propose to post here that modules (in OSM or screenshot), so anybody can help with the choosing, adding short explanation.
I start with an example. It`s a real doubth from mine, so please help
If anyone has the same problem that me, I propose to post here that modules (in OSM or screenshot), so anybody can help with the choosing, adding short explanation.
I start with an example. It`s a real doubth from mine, so please help
-
gvalletto - Posts: 117
- Joined: Fri Jul 09, 2010 10:15 pm
- Location: Argentina
Re: What is better?
This is a very interesting idea for a topic. In most cases I won’t be able to help but I hope to learn from anyone else who can give explanations.
I do know that the number of triggers generated when something changes is important, so one thing I could suggest is to make use of the trigger counter module as a basis for comparison. But that doesn’t take into account of what happens “inside” the various prims.
Cheers
Spogg
I do know that the number of triggers generated when something changes is important, so one thing I could suggest is to make use of the trigger counter module as a basis for comparison. But that doesn’t take into account of what happens “inside” the various prims.
Cheers
Spogg
-
Spogg - Posts: 3358
- Joined: Thu Nov 20, 2014 4:24 pm
- Location: Birmingham, England
Re: What is better?
Hello!
When i want to test something on CPU usage and compare it - i do a loop an call it "a lot" like here 1000000 times.
Then i do a measurement from the time it needs. The lower time - the more cpu efficient
I made a tiny schematic with an time-measurement that calls the selecter and the array in the same way - including at least one "Int-Input-Box" to show the value and simulate to do something.
Results:
On 1000000 steps the selector needs: 0.496 seconds to complete
On 1000000 steps the array needs: 0.437 seconds to complete
Something equivalent in ruby by array need 0.073 seconds.
Warning:
Do not match ruby and green! Ruby and green are running dethreaded and would not deliver the correct time-measurement!
Edit and Summery:
It seems the Array is a little faster - and i think it is more comfortable to use.
If you want to built something that need realy cpu efficiency you should go into ruby and stay there until you got the final results and then pass them to green.
Regards, C.Hackl
When i want to test something on CPU usage and compare it - i do a loop an call it "a lot" like here 1000000 times.
Then i do a measurement from the time it needs. The lower time - the more cpu efficient
I made a tiny schematic with an time-measurement that calls the selecter and the array in the same way - including at least one "Int-Input-Box" to show the value and simulate to do something.
Results:
On 1000000 steps the selector needs: 0.496 seconds to complete
On 1000000 steps the array needs: 0.437 seconds to complete
Something equivalent in ruby by array need 0.073 seconds.
Warning:
Do not match ruby and green! Ruby and green are running dethreaded and would not deliver the correct time-measurement!
Edit and Summery:
It seems the Array is a little faster - and i think it is more comfortable to use.
If you want to built something that need realy cpu efficiency you should go into ruby and stay there until you got the final results and then pass them to green.
Regards, C.Hackl
- Attachments
-
- Test-Selector-vs-Array.fsm
- (1.37 KiB) Downloaded 952 times
100% accuracy is the guarantee to your success. The value alters if you combine it with musical creativity.
-
chackl - Posts: 233
- Joined: Tue Aug 17, 2010 8:46 pm
- Location: Austria / Salzburg
Re: What is better?
Just make sure that any tests involving Ruby stay a good portion under 10 seconds, as this is the latest at which Flowstone will automatically shutdown Ruby assuming an infinite loop.
EDIT: And a reminder that the array example only was slightly quicker, because the get at prim sends no backtriggers but stores the converted array (and so no string to array conversion on each "get at" takes place). This is not always the case! A lot of prims do use backtriggers.
EDIT: And a reminder that the array example only was slightly quicker, because the get at prim sends no backtriggers but stores the converted array (and so no string to array conversion on each "get at" takes place). This is not always the case! A lot of prims do use backtriggers.
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: What is better?
tulamide wrote:Just make sure that any tests involving Ruby stay a good portion under 10 seconds, as this is the latest at which Flowstone will automatically shutdown Ruby assuming an infinite loop.
EDIT: And a reminder that the array example only was slightly quicker, because the get at prim sends no backtriggers but stores the converted array (and so no string to array conversion on each "get at" takes place). This is not always the case! A lot of prims do use backtriggers.
you make an interesting point regarding the array
-
wlangfor@uoguelph.ca - Posts: 912
- Joined: Tue Apr 03, 2018 5:50 pm
- Location: North Bay, Ontario, Canada
Re: What is better?
I am happy with all the posts, and I am glad that them make interest for several people. Go ahead!
-
gvalletto - Posts: 117
- Joined: Fri Jul 09, 2010 10:15 pm
- Location: Argentina
Re: What is better?
You forgot another primitive, if else. It'd be sensible to test it against that, also the index selector come to think of it. Just name the string number names, does the same.
Makes Me curious,
Makes Me curious,
-
wlangfor@uoguelph.ca - Posts: 912
- Joined: Tue Apr 03, 2018 5:50 pm
- Location: North Bay, Ontario, Canada
Re: What is better?
Good sugestions! Thanks.
-
gvalletto - Posts: 117
- Joined: Fri Jul 09, 2010 10:15 pm
- Location: Argentina
10 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 45 guests