Recent Posts

Pages: 1 ... 4 5 [6] 7 8 ... 10
51
QB64 Discussion / Re: Input output methods and hardware opinions
« Last post by Parkland on April 12, 2022, 08:57:00 pm »
After some deliberating, I decided to use an RS485 adapter and ordered modbus RTU relay controllers and sensors.
It looks pretty simple just connect devices to wires and send and receive data back and forth in hexadecimal values.
The default device speeds are all 9600 baud but can be set way faster.
For high speed data acquisition even 56k baud might be too slow but for my purposes this seems perfect.
I imagine I should be able to poll several values a second no problem which is all I need.

I'll update once the stuff shows up if there's any unforeseen issues but it seems pretty straight forward.
52
Programs / Re: Better Bench by Ed Davis
« Last post by jack on April 11, 2022, 08:30:11 pm »
in Linux x64 same PC I get
3.79 seconds with no optimization
3.58 seconds with -O2 optimization
3.06 seconds with -Ofast optimization
53
QB64 Discussion / Re: QB64 Bounty List
« Last post by keybone on April 11, 2022, 06:42:58 pm »
Just a few days ago, I had the misfortune of having to fill up my tractor's fuel tank from being almost empty.  400 gallons @ almost $5.00 per gallon...  And then a sinking feeling hit the core of my gut as I realized I was going to have to repeat such an experience dozens of times this year.  /cry

54
Programs / Re: Better Bench by Ed Davis
« Last post by Ed Davis on April 11, 2022, 06:10:07 pm »
All I was doing was as I was asked here:


Just to make sure:  I appreciate your posts, and help that you so graciously freely provide. 

And I appreciate this forum - lots of knowledgeable, helpful folks around here!  And all the great example programs!

Thanks!
55
Programs / Re: Better Bench by Ed Davis
« Last post by SMcNeill on April 11, 2022, 05:49:55 pm »
I purposefully did not try to optimize it for any single language, but rather wanted the same code for each language.

All I was doing was as I was asked here:

Can anyone make a significant drop?

It's hard to make a drop in speeds, without making any changes to the code to help optimize for speed.  ;)

But, I agree -- you can't compare apples to pineapples.  Speed tests between systems/languages should match so you can compare the performance between those systems/languages without skewing the results. 
56
Programs / Re: Better Bench by Ed Davis
« Last post by Ed Davis on April 11, 2022, 05:43:41 pm »

Only 2 real changes here:

...

2) I took out the negative multiplication and swapped to negation, which we always process fast.  (-1 * x isn't as efficient as -x, for example.)


But that change makes it a slightly different comparison between different languages.

I purposefully did not try to optimize it for any single language, but rather wanted the same code for each language.

For example, I could have used "i++" instead of "i = i + 1".  Some really poor byte-code interpreters (some of mine :( ) do not recognize that these are the same, and generate:

Code: QB64: [Select]
  1. inc [i]
For the former, and:

Code: QB64: [Select]
  1. push [i]
  2. add
  3. pop [i]
  4.  

For the latter.  Definitely slower, as it has to go two extra times through the byte code interpreter loop.

I could have used "for" loops, which some languages optimize better than "while" loops.

But since all languages I was testing did not offer those things, I avoided them.

So the goal was not to write the fastest algorithm - but to write to write something to test that could be easily converted to many languages.

But of course, you are free to do what you want :) However, if you're going to compare it with another language processor, it would be more fair to optimize the code for that processor also.

Finally, not trying to cause trouble or anything like that.  Just trying to explain the purpose of the code.

It is at best a silly diversion, and like all bench marks, should be taken with a grain of salt, or just completely ignored!
57
Programs / Re: Better Bench by Ed Davis
« Last post by George McGinn on April 11, 2022, 05:39:12 pm »
I get 5.533 seconds.
58
Programs / Re: Better Bench by Ed Davis
« Last post by SMcNeill on April 11, 2022, 05:20:05 pm »
 
Screenshot.png


Best I can come up with, without trying to revert to mem or compiler flags, is about 4.9 seconds on my laptop.

Code: QB64: [Select]
  1. 'DefLng A-Z
  2. 'Dim As Double x, y, xx, yy, start
  3. start = Timer(.001)
  4. accum = 0
  5. count = 0
  6. While count < 1545
  7.     leftedge = -420
  8.     rightedge = 300
  9.     topedge = 300
  10.     bottomedge = -300
  11.     xstep = 7
  12.     ystep = 15
  13.  
  14.     maxiter = 200
  15.  
  16.     y0 = topedge
  17.     While y0 > bottomedge
  18.         x0 = leftedge
  19.         While x0 < rightedge
  20.             y = 0
  21.             x = 0
  22.             thechar = 32
  23.             xx = 0
  24.             yy = 0
  25.             i = 0
  26.             While i < maxiter And xx + yy <= 800
  27.                 xx = Int((x * x) / 200)
  28.                 yy = Int((y * y) / 200)
  29.                 If xx + yy > 800 Then
  30.                     thechar = 48 + i
  31.                     If i > 9 Then
  32.                         thechar = 64
  33.                     End If
  34.                 Else
  35.                     temp = xx - yy + x0
  36.                     If (x < 0 And y > 0) Or (x > 0 And y < 0) Then
  37.                         y = (-Int((-x * y) / 100)) + y0 ' << this line was revised in later post
  38.                     Else
  39.                         y = Int(x * y / 100) + y0
  40.                     End If
  41.                     x = temp
  42.                 End If
  43.  
  44.                 i = i + 1
  45.             Wend
  46.             x0 = x0 + xstep
  47.             accum = accum + thechar
  48.         Wend
  49.         y0 = y0 - ystep
  50.     Wend
  51.  
  52.     If count Mod 300 = 0 Then
  53.         Print accum,
  54.     End If
  55.     count = count + 1
  56.  
  57. Print accum
  58. Print Timer(.001) - start; " seconds"
  59.  
  60. 'This is the output:
  61.  
  62. Print "Compared to expected output of: "
  63. Print "200574 60372774 120544974 180717174 240889374 301061574 309886830"

Only 2 real changes here:

1) I made all variables _DOUBLE type.  When it comes to optimizing speed, QB64 always seems to run better if you can stick with all variables of the same type -- either go all integers, or all floats, if you want speed.  Mixing them seems to always slow things down.

2) I took out the negative multiplication and swapped to negation, which we always process fast.  (-1 * x isn't as efficient as -x, for example.)

Nothing else stares out obviously to me as a means to run the code faster, without going to _MEM access or tweaking compiler options for -fastmath. 
59
Programs / Re: Better Bench by Ed Davis
« Last post by jack on April 11, 2022, 05:19:07 pm »
Hi bplus and Ed Davis
here's my result
Code: [Select]
QB64
 200574   60372774            120544974           180717174           240889374
 301061574          309886830
 4.637000000002445  seconds

FreeBasic
 200574        60372774      120544974     180717174     240889374     301061574     309886830
 2.118056500097737 seconds
well done bplus :)
note: QB64 includes a lot of runtime checks which slowdown performance, even with $Checking:Off
60
QB64 Discussion / Re: QB64 Bounty List
« Last post by madscijr on April 11, 2022, 05:15:09 pm »
Petrol here in the UK works out at around $10.62 a gallon at current exchange rate.
If anything comes of this 'pay per fix' then I have got a few things I would like to see mainly concerning pdf files, barcodes and qrcodes.

Anything that makes qb64 more useful for business apps or practical day to day usefulness can't be bad!
Pages: 1 ... 4 5 [6] 7 8 ... 10