epiCode Active Member Licensed User Nov 24, 2021 #1 In the following two scenarios: B4X: .... processData (bv as view,..........) .... private sub processData(bv as view,....) ..... bv.add(somepanel,......) end sub AND B4X: .... somepanel = processData (some params..........) bv.add ( somepanel, .......) .... private sub processData(some params....) as somepanel ..... return somepanel end sub my queries are 1. which of these codes will be faster (assuming that processdata is called a lot of times during CLV loading) 2. will having many parameters passed through call reduce performance or it will be barely noticeable ? Thanks
In the following two scenarios: B4X: .... processData (bv as view,..........) .... private sub processData(bv as view,....) ..... bv.add(somepanel,......) end sub AND B4X: .... somepanel = processData (some params..........) bv.add ( somepanel, .......) .... private sub processData(some params....) as somepanel ..... return somepanel end sub my queries are 1. which of these codes will be faster (assuming that processdata is called a lot of times during CLV loading) 2. will having many parameters passed through call reduce performance or it will be barely noticeable ? Thanks
Solution Erel Nov 24, 2021 mohsyn said: While I appreciate what you want to convey here, this is stemming from the fact that when I'm passing whole lot parameters to reduce duplication of code it is actually slowing down CLV loading a lot Click to expand... No it doesn't. You can pass million views and it will be extremely fast. 1. Make sure to test performance in release mode. 2. If something is slow, it is unrelated to the views passed. When you pass a view, you are not making a copy of any object. It is a simple pointer that is passed.
mohsyn said: While I appreciate what you want to convey here, this is stemming from the fact that when I'm passing whole lot parameters to reduce duplication of code it is actually slowing down CLV loading a lot Click to expand... No it doesn't. You can pass million views and it will be extremely fast. 1. Make sure to test performance in release mode. 2. If something is slow, it is unrelated to the views passed. When you pass a view, you are not making a copy of any object. It is a simple pointer that is passed.
agraham Expert Licensed User Longtime User Nov 24, 2021 #2 You are over thinking things. Premature optimisation is the enemy of good code. Just write the code it in a straightforward and understandable way and see if it is good enough. Upvote 1
You are over thinking things. Premature optimisation is the enemy of good code. Just write the code it in a straightforward and understandable way and see if it is good enough.
epiCode Active Member Licensed User Nov 24, 2021 #3 agraham said: You are over thinking things. Premature optimisation is the enemy of good code. Just write the code it in a straightforward and understandable way and see if it is good enough. Click to expand... While I appreciate what you want to convey here, this is stemming from the fact that when I'm passing whole lot parameters to reduce duplication of code it is actually slowing down CLV loading a lot - If I don't I am getting into unwanted initialization issues. Hence seeking advice before I waste more time restructuring code. Upvote 0
agraham said: You are over thinking things. Premature optimisation is the enemy of good code. Just write the code it in a straightforward and understandable way and see if it is good enough. Click to expand... While I appreciate what you want to convey here, this is stemming from the fact that when I'm passing whole lot parameters to reduce duplication of code it is actually slowing down CLV loading a lot - If I don't I am getting into unwanted initialization issues. Hence seeking advice before I waste more time restructuring code.
Erel B4X founder Staff member Licensed User Longtime User Nov 24, 2021 #4 mohsyn said: While I appreciate what you want to convey here, this is stemming from the fact that when I'm passing whole lot parameters to reduce duplication of code it is actually slowing down CLV loading a lot Click to expand... No it doesn't. You can pass million views and it will be extremely fast. 1. Make sure to test performance in release mode. 2. If something is slow, it is unrelated to the views passed. When you pass a view, you are not making a copy of any object. It is a simple pointer that is passed. Upvote 1 Solution
mohsyn said: While I appreciate what you want to convey here, this is stemming from the fact that when I'm passing whole lot parameters to reduce duplication of code it is actually slowing down CLV loading a lot Click to expand... No it doesn't. You can pass million views and it will be extremely fast. 1. Make sure to test performance in release mode. 2. If something is slow, it is unrelated to the views passed. When you pass a view, you are not making a copy of any object. It is a simple pointer that is passed.
epiCode Active Member Licensed User Nov 24, 2021 #5 Erel said: No it doesn't. You can pass million views and it will be extremely fast. 1. Make sure to test performance in release mode. 2. If something is slow, it is unrelated to the views passed. When you pass a view, you are not making a copy of any object. It is a simple pointer that is passed. Click to expand... Thanks Erel - That clarifies that the slowdown issue has to be something in my code itself and not where the view related transactions happen. Upvote 0
Erel said: No it doesn't. You can pass million views and it will be extremely fast. 1. Make sure to test performance in release mode. 2. If something is slow, it is unrelated to the views passed. When you pass a view, you are not making a copy of any object. It is a simple pointer that is passed. Click to expand... Thanks Erel - That clarifies that the slowdown issue has to be something in my code itself and not where the view related transactions happen.