NewList void.l()
For a = 1 To 5
SelectElement(void(), 0) ; the newest value should be at the front of the list(!)
AddElement(void())
void()=a
Next
ForEach void()
Debug void()
Next
Result: ????
1
5
4
3
2
Correct to expect would be:
5
4
3
2
1
// Moved from "Bugs - Windows" to "Coding Questions" (Kiffi) // Added code tags (Kiffi)
NewList void.l()
count = 50000000
time = ElapsedMilliseconds()
For a = 1 To count
InsertElement(void())
void()=a
Next
Debug " - "+Str(ElapsedMilliseconds()-time) ; result - 9659
Debug " --- "
ClearList(void())
time = ElapsedMilliseconds()
For a = 1 To count
ResetList(void())
AddElement(void())
void() = a
Next
Debug " - "+Str(ElapsedMilliseconds()-time) ; result - 11339
mestnyi wrote: ↑Thu Feb 02, 2023 4:41 pm
Interesting.
As long as you are using the Debugger there is nothing interesting about that. But even without the the debugger it should be clear that it is slower to have two function calls instead of just one.
Edith:
Here are the differences on my system with and without debugger:
NewList void.l()
count = 50000000
OpenConsole()
time = ElapsedMilliseconds()
For a = 1 To count
InsertElement(void())
void()=a
Next
time = ElapsedMilliseconds() - time
PrintN(" - " + time)
PrintN(" --- ")
ClearList(void())
time = ElapsedMilliseconds()
For a = 1 To count
ResetList(void())
AddElement(void())
void() = a
Next
time = ElapsedMilliseconds() - time
PrintN(" - " + time)
Input()
CloseConsole()
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
mestnyi wrote: ↑Thu Feb 02, 2023 7:44 pm
Your example does nothing on Macos.
Yes, you are right that two calls will be slower.
I was wondering what else works.
If you are on Mac or Linux you need to set the executable format to "Console" in the compiler options. Otherwise the console window does not show up.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
mestnyi wrote: ↑Thu Feb 02, 2023 7:44 pm
Your example does nothing on Macos.
Yes, you are right that two calls will be slower.
I was wondering what else works.
If you are on Mac or Linux you need to set the executable format to "Console" in the compiler options. Otherwise the console window does not show up.
I did not know it.
how this other behavior hurts me.
or rather, how to do it, I did not find in the settings.
mestnyi wrote: ↑Thu Feb 02, 2023 7:44 pm
Your example does nothing on Macos.
Yes, you are right that two calls will be slower.
I was wondering what else works.
If you are on Mac or Linux you need to set the executable format to "Console" in the compiler options. Otherwise the console window does not show up.
I did not know it.
how this other behavior hurts me.
or rather, how to do it, I did not find in the settings.
Under Compiler options, where you also set whether it is a Window APP or a DLL,SO,DyLib