Author Topic: Benchmark_01  (Read 1568 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Benchmark_01
« on: April 10, 2022, 01:55:11 pm »
Can someone verify this code is correct and it takes under .5 secs to run, Aurel doesn't believe it.
http://basic4all.epizy.com/index.php?topic=21.0

Code: QB64: [Select]
  1. start = Timer(.001)
  2. For n = 1 To 100000000
  3.     r = n * 2 - Sin(88)
  4. Next n&
  5. Print Timer(.001) - start; "seconds"
  6.  

 
image_2022-04-10_135600031.png


BTW oddly it does better with Double than with Single default.

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
Re: Benchmark_01
« Reply #1 on: April 10, 2022, 02:31:04 pm »
it times at .25 seconds on my PC
but as a benchmark it's lame, a good compiler will eliminate the loop entirely and therefore give a meaningless result

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: Benchmark_01
« Reply #2 on: April 10, 2022, 02:44:58 pm »
Thank you Jack! Keybonic Plague also gets way better time than I with optimized QB64 dev 2.1

I know it's lame I didn't make it up just comparing times with other PL's and Basic's.

So I didn't screw up, it's possible to get under .5 secs.

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
Re: Benchmark_01
« Reply #3 on: April 10, 2022, 02:51:32 pm »
I meant no offense to you bplus, I know who came up with the code
but if you want to do a benchmark you need to do some computations that can't be optimized out and print the result for verification

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
Re: Benchmark_01
« Reply #4 on: April 10, 2022, 10:10:00 pm »
4.07s on my ancient machine.
It works better if you plug it in.