Re: [Gambas-user] For...Next loop efficiency question

2012-02-23 Thread Kevin Fishburne
On 02/23/2012 11:21 AM, Jussi Lahtinen wrote: > Nested loops are of course different thing... > > Jussi I was about to ask in what way, then I realized that the "inner" loop would have to be recalculated every time the "outer" loop executed. Good call there. :) -- Kevin Fishburne Eight Virtues

Re: [Gambas-user] I need your help, please!

2012-02-23 Thread Emil Lenngren
How large is your csv-file? If it is large then probably much time is spent when transfering the data from your hard drive into memory. /Emil 2012/2/23 M. Cs. > I have few simple questions: > what is happening practically with the memory when I open a file and > start to read it in into a local

[Gambas-user] I need your help, please!

2012-02-23 Thread M. Cs.
I have few simple questions: what is happening practically with the memory when I open a file and start to read it in into a local variable called myvar? It would be logical for myvar to grow until it reads in the entire file. My question is: - does Gambas clear the memory allocations after the myv

Re: [Gambas-user] String array empty after SUB (Gambas 2)

2012-02-23 Thread nando
felder as STRING[] is a parameter passed into sub It is no good outside of SUB What you should do is make your sub PUBLIC FUNCTION ListeKundeFelder(schlysselnr AS String, felder AS String[]) AS STRING[] and return the string[], assigning it to the original felder[] -Fernando -- Or

Re: [Gambas-user] For...Next loop efficiency question

2012-02-23 Thread Jussi Lahtinen
Nested loops are of course different thing... Jussi On Thu, Feb 23, 2012 at 12:31, Kevin Fishburne < kevinfishbu...@eightvirtues.com> wrote: > Thank you everyone, that information is extremely useful. You can also > time several repetitions of the code and compare the results. It seems > decla

Re: [Gambas-user] String array empty after SUB (Gambas 2)

2012-02-23 Thread Emil Lenngren
The problem is not that feld.copy does not copy the array or something like that, it really returns a NEW deep copy of the array, i.e. a new object. When you call the function by executing ldsv.ListeKundeFelder(schlyssel[ls.Index], felder) you pass the reference to a String[] you want to populate

Re: [Gambas-user] For...Next loop efficiency question

2012-02-23 Thread Kevin Fishburne
Thank you everyone, that information is extremely useful. You can also time several repetitions of the code and compare the results. It seems declaration and pre computation of variables involved in a For...Next loop isn't necessary other than for legibility, which is awesome. -- Kevin Fishbur

Re: [Gambas-user] String array empty after SUB (Gambas 2)

2012-02-23 Thread Bruce Bruen
On Thu, 2012-02-23 at 09:09 +0100, Rolf-Werner Eilert wrote: > That was it, Jussi, thanks a lot! > > Here we can see what it is good for to know about OOP :-) > > Regards > > Rolf > > Am 22.02.2012 18:49, schrieb Jussi Lahtinen: > > Just quick thought... maybe this "felder = feld.Copy()" gives

Re: [Gambas-user] For...Next loop efficiency question

2012-02-23 Thread Emil Lenngren
Gambas is open source, so you can always look in the source code how everything is implemented. e.g. look in gbx_exec_loop.c and look for jump_next. /Emil 2012/2/23 Rolf-Werner Eilert > Kevin, > > As far as I found out, it is done only once at the beginning. Just make > a test: set a stop point

Re: [Gambas-user] For...Next loop efficiency question

2012-02-23 Thread Rolf-Werner Eilert
Kevin, As far as I found out, it is done only once at the beginning. Just make a test: set a stop point before the loop, and than make single steps through the loop watching the local variables. I use this for getting clear about efficiency from time to time, and I found it a pretty eye-opener

Re: [Gambas-user] String array empty after SUB (Gambas 2)

2012-02-23 Thread Rolf-Werner Eilert
Am 22.02.2012 20:26, schrieb GMail: > On Wed, 2012-02-22 at 19:49 +0200, Jussi Lahtinen wrote: >> Just quick thought... maybe this "felder = feld.Copy()" gives new object >> reference feld to felder. >> And because feld is declared locally, the it is null after the sub and so >> is also felder. >>

Re: [Gambas-user] String array empty after SUB (Gambas 2)

2012-02-23 Thread Rolf-Werner Eilert
That was it, Jussi, thanks a lot! Here we can see what it is good for to know about OOP :-) Regards Rolf Am 22.02.2012 18:49, schrieb Jussi Lahtinen: > Just quick thought... maybe this "felder = feld.Copy()" gives new object > reference feld to felder. > And because feld is declared locally, th

Re: [Gambas-user] For...Next loop efficiency question

2012-02-23 Thread Emil Lenngren
The calculation is done only once in the beginning of the loop. /Emil 2012/2/23 Kevin Fishburne > If the ranges of a For...Next loop require calculations, are they slower > than a loop which doesn't? In other words, is the first example below > faster than the second? > > For Counter = 1 To 100