Re: the "price" of a context switch/function call

2014-10-09 Thread Geoff Canyon
I took just about the worst case scenario: a single-line function I wrote a few weeks back: function isLeapYear Y return Y is a number and Y mod 4 = 0 and (Y mod 100 > 0 or Y mod 400 = 0) end isLeapYear If any function is going to pay the price for the cost of a function call, that's it -- ther

RE: the "price" of a context switch/function call

2014-10-08 Thread Ralph DiMola
Mark talked about the cost of context switching at RR14. The default "by value" parameters in a call will be "by reference" until data has changed. Only then will a local copy be created. So... If you pass a large array only the keys that have been changed(if any) are allocated new memory and copie

Re: the "price" of a context switch/function call

2014-10-08 Thread Bob Sneidar
I get caught up in such thoughts from time to time, and then wake up to realize that the slow method is having absolutely no noticeable effect on the speed of my app, and won’t in the foreseeable future because the app is not of such a nature that it will scale to the point that it would. Then

Re: the "price" of a context switch/function call

2014-10-05 Thread Roger Eller
It is for this very reason, I sometimes must kick myself. The more time I spend optimizing a routine, these "moments of clarity" happen, and a complex solution seems so simple. Not so when I return to it as my future self. Sent from my Android tablet On Oct 5, 2014 1:43 AM, "Mark Wieder" wrote:

Re: the "price" of a context switch/function call

2014-10-04 Thread Mark Wieder
JB- Saturday, October 4, 2014, 8:55:28 PM, you wrote: > I recently read a similar statement but I can’t rembenter > where. Maybe if was from Apple about Xcode. What > they said was even if you lose a little speed you are > better off writing code that is easy for you to rend and > understand in

Re: the "price" of a context switch/function call

2014-10-04 Thread JB
I recently read a similar statement but I can’t rembenter where. Maybe if was from Apple about Xcode. What they said was even if you lose a little speed you are better off writing code that is easy for you to rend and understand instead of making it too complex. John Balgenorth On Oct 4, 2014,

Re: the "price" of a context switch/function call

2014-10-04 Thread Mark Wieder
Geoff- Saturday, October 4, 2014, 6:27:41 PM, you wrote: > On Sat, Oct 4, 2014 at 12:54 PM, Dr. Hawkins wrote: >> If I'm going to call a routine, say, 100 times in a fraction of a second, >> do I really save much by inlining it rather than calling it as a function? >> > Premature optimization

Re: the "price" of a context switch/function call

2014-10-04 Thread Geoff Canyon
On Sat, Oct 4, 2014 at 12:54 PM, Dr. Hawkins wrote: > If I'm going to call a routine, say, 100 times in a fraction of a second, > do I really save much by inlining it rather than calling it as a function? > Premature optimization is the root of evil. If you write clean code, it will be straight

Re: the "price" of a context switch/function call

2014-10-04 Thread dunbarx
4, 2014 1:55 pm Subject: the "price" of a context switch/function call I'm eternally conflicted between the needed frugality of my eight bit childhood and the desire for clean code . . . And I never forget the model I wrote in smalltalk with nice "proper" OO message pa

the "price" of a context switch/function call

2014-10-04 Thread Dr. Hawkins
I'm eternally conflicted between the needed frugality of my eight bit childhood and the desire for clean code . . . And I never forget the model I wrote in smalltalk with nice "proper" OO message passing (the messages I was modeling, in fact), and then rewrote line for line in Fortran without opt