Author Topic: FOR i = 1 TO 0 is slow?  (Read 7431 times)

0 Members and 1 Guest are viewing this topic.

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: FOR i = 1 TO 0 is slow?
« Reply #15 on: June 06, 2019, 11:07:11 am »
running on my desktop, also VISTA get more consistant times, but GOTO becomes the fastest and While\Wend the slowest!!(see image)
(both these machines are using an INTEL processor)

with Steve's checking off version, everything gets ~1.5secs faster except for\next which stays nearly the same. GOTO(3.90) comes in first, then DO\Loop(4.23) then WHILE\Wend(4.33) and last is for\next(5.27).

running everything a LONG instead of _INTEGER64 knocks nearly another second+ off(save for\next). GOTO still wins(2.58), fallowed by WHILE\WEND(2.91), then DO\LOOP(2.96) and last FOR\NEXT(5.38)
« Last Edit: June 06, 2019, 11:33:10 am by Cobalt »
Granted after becoming radioactive I only have a half-life!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: FOR i = 1 TO 0 is slow?
« Reply #16 on: June 06, 2019, 11:22:40 am »
running on my desktop, also VISTA get more consistant times, but GOTO becomes the fastest and While\Wend the slowest!!

From the numbers you posted, don’t you mean FOR..NEXT was the slowest?
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: FOR i = 1 TO 0 is slow?
« Reply #17 on: June 06, 2019, 11:30:00 am »
From the numbers you posted, don’t you mean FOR..NEXT was the slowest?

look at the image of the 4 runs I performed on B+ code. I didn't do screenshots of the last runs where I used your CHECKING: OFF code.
« Last Edit: June 06, 2019, 11:32:14 am by Cobalt »
Granted after becoming radioactive I only have a half-life!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: FOR i = 1 TO 0 is slow?
« Reply #18 on: June 06, 2019, 12:37:57 pm »
I find it extremely interesting that Colbalt gets best times from GOTO, that was what I originally wanted to test when I compared to WHILE ...WEND structure before adding on all the other loop structures with mods.
« Last Edit: June 06, 2019, 12:39:07 pm by bplus »

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: FOR i = 1 TO 0 is slow?
« Reply #19 on: June 07, 2019, 01:19:19 am »

... s(2.58), fallowed by WHILE\WEND(2.91), th ...
been looking up info on fallow deer too much! :D
Ah well.

I have to say that maybe the for\next routines need rewritten. I was going to 'hack' the MAIN.TXT in the temp folder to see if I could get better time from for\next, but i couldn't figure out just how the for\next was actually being handled, cause I don't see anything that resembles an actual FOR statement it in the code. I was curious just how a standard for\next loop would stack up if I just hard coded in the C++ code. I wonder if there is some weird nuance in QB45's for\next that Galleon was trying to account for by translating it this way? or maybe he was just stoned when he wrote it?
Granted after becoming radioactive I only have a half-life!

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: FOR i = 1 TO 0 is slow?
« Reply #20 on: June 07, 2019, 04:58:56 am »
Hi Guys
here my feedback on Windows10 and QB64 1.3

  [ You are not allowed to view this attachment ]  

about TRANSlation in QBASIC to C++ I think that there is an Option in Google Translation, but I think we get more another version

Programming isn't difficult, only it's  consuming time and coffee

Offline RhoSigma

  • QB64 Developer
  • Forum Resident
  • Posts: 565
    • View Profile
Re: FOR i = 1 TO 0 is slow?
« Reply #21 on: June 07, 2019, 05:53:29 am »
????? Google can translate BASIC into C++ ?????

How??
My Projects:   https://qb64forum.alephc.xyz/index.php?topic=809
GuiTools - A graphic UI framework (can do multiple UI forms/windows in one program)
Libraries - ImageProcess, StringBuffers (virt. files), MD5/SHA2-Hash, LZW etc.
Bonus - Blankers, QB64/Notepad++ setup pack

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: FOR i = 1 TO 0 is slow?
« Reply #22 on: June 07, 2019, 01:39:56 pm »
Really?
see here what say google when you type translate BASIC to C...

https://www.google.it/search?source=hp&ei=rpz6XNm5H6_isAfupIrAAg&q=translate+BASIC+to+C&oq=translate+BASIC+to+C&gs_l=psy-ab.12..33i22i29i30l10.2379.2379..7658...0.0..0.456.456.4-1......0....2j1..gws-wiz.....0.VIio-WwhkpM

However, going out of joke , I have no technical knowdledge to show you what is needed to translate from a High Level language to Another High Level language...
I can imagine that the path is the same for BASIC and C compiled,
BASIC-->Assembler of BASIC compiler and libraries-->CodeMachine
C-->Assembler of C compiler and libraries--> CodeMachine
So you can easly translate from BASIC to C in the manner C has structures similar to those of  BASIC or can emulate those of BASIC...

How a compiler can make cross platform executable, I don't know and I ignore also if GCC o g++ can do this kind of performance.

PS I have found this affirmation that scares me
https://quotefancy.com/quote/1164258/Edsger-W-Dijkstra-Programming-in-Basic-causes-brain-damage

Programming isn't difficult, only it's  consuming time and coffee

Offline RhoSigma

  • QB64 Developer
  • Forum Resident
  • Posts: 565
    • View Profile
Re: FOR i = 1 TO 0 is slow?
« Reply #23 on: June 07, 2019, 03:39:05 pm »
Ah, i see, these are search results for diverse code convertors.

I was curios about, because you mentioned and option in "Google Translate", but maybe i got that wrong.

On the other side, it would be cool, if there were a way translating between programming languages using "Google Translate" just like it works for real spoken languages. Maybe we should suggest this as an enhancement to the Google Support board :)
My Projects:   https://qb64forum.alephc.xyz/index.php?topic=809
GuiTools - A graphic UI framework (can do multiple UI forms/windows in one program)
Libraries - ImageProcess, StringBuffers (virt. files), MD5/SHA2-Hash, LZW etc.
Bonus - Blankers, QB64/Notepad++ setup pack

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: FOR i = 1 TO 0 is slow?
« Reply #24 on: June 07, 2019, 08:13:28 pm »
Quote
I was curios about, because you mentioned and option in "Google Translate", but maybe i got that wrong.

That was a joke of mine but I ignore if there is an underground option of Google Translate!
:-)
Programming isn't difficult, only it's  consuming time and coffee

Offline SW

  • Newbie
  • Posts: 6
    • View Profile
Re: FOR i = 1 TO 0 is slow?
« Reply #25 on: June 11, 2019, 11:57:01 pm »
Win7 SP1 on i7 2600
 [ You are not allowed to view this attachment ]  

Offline Raven_Singularity

  • Forum Regular
  • Posts: 158
    • View Profile
Re: FOR i = 1 TO 0 is slow?
« Reply #26 on: June 12, 2019, 09:48:35 am »
You said the times were fairly random each run.  This suggests that something is probably using your CPU (other apps or background services running), or something is causing delays (anti-malware/anti-virus apps, etc.).

Check your Task Manager to ensure your CPU is steady at 0% before you run the test, and ensure your virus/malware apps whitelist/ignore QB64.