Basicprogramming(.org) > General questions and discussions

Method or Madness ;-))

<< < (3/4) > >>

Rick3137:

--- Quote from: B+ on May 28, 2017, 04:27:42 pm ---Rick your numbers are shockingly weird to me, wow!

For me SdlBasic circle fill tests ran a bit slower which was surprising because usually SB graphics translations run faster in SdlBasic.

But Rick you have SB 10 times faster than I and SdlBasic many times slower??? yikes, that is crazy different and you use Windows 10 as I recall, maybe your much newer machine explains difference (but why would SdlBasic be so much slower than my results?)

BTW the Bresenham algo in Sdlbasic did not show improved results over my new circle algo but for me ran in between my old and new cilrcle algos. I posted code at SdlBasic forum to see if my translation was missing something.

Rick could I see your SdlBasic translation for the numbers you posted?

--- End quote ---



--- Code: ---' New circle algo test.sdlbas (B+=MGA) 2017-05-26
' Johnno has reported 3 times slower not faster than SmallBASIC results
' Here is my code check from
' new circle algo test.bas for SmallBASIC 0.12.9 (B+=MGA) 2017-05-25 post
' MIT license info below for fCirc2 algo

option qbasic
const xmax = 1200
const ymax = 700
setdisplay(xmax, ymax, 32, 1)
setcaption("New circle algo test For SdlBasic")

const sqr12 = sqr(.5)
radius = 350
ox = xmax/2
oy = ymax/2

t0 = ticks
for i = 1 to 100
  ink(rgb(rnd(255), rnd(255), rnd(255)))
  fCirc( ox, oy, radius)
next
t = ticks - t0
text(10, 20, 16, Str( t) + " ms to draw 100 of these filled circles (r =350) my old fastest algo.")
wait( 4000)

t0 = ticks
for i = 1 to 100
  ink(rgb(rnd(255), rnd(255), rnd(255)))
  fCirc2(ox, oy, radius)
next
t = ticks - t0
text(10, 40, 16, str(t) + " ms for same circle test with new fastest algo.")
waitkey(32)
end

sub fCirc(xx, yy, r)
r2 = r * r
for x = 0 to r
  y = sqr(r2-x*x)
  line( xx-x, yy+y, xx-x, yy-y)
  line( xx+x, yy+y, xx+x, yy-y)
next
end sub

sub fCirc2(xx, yy, r)
  'const sqr12 = sqr(.5) 'in main const section
  r2 = r * r
  sqr12r = sqr12*r
  bar( xx-sqr12r, yy-sqr12r, xx + sqr12r, yy+sqr12r)
  for x = 0 to sqr12r
    y = sqr(r2-x*x)
    line( xx-x, yy+sqr12r, xx-x, yy+y)
    line( xx-x, yy-sqr12r, xx-x, yy-y)
    line( xx+x, yy+sqr12r, xx+x, yy+y)
    line( xx+x, yy-sqr12r, xx+x, yy-y)
  next
  for x = sqr12*r to r
    y = sqr(r2-x*x)
    line(xx-x, yy+y, xx-x, yy-y)
    line( xx+x, yy+y, xx+x, yy-y)
  next
end sub

'##################################################################################
'
'# The MIT License (MIT)
'# Copyright (c) 2016-2017 B+=MGA
'#
'# Permission is hereby granted, free of charge, to any person obtaining a copy
'# of this software and associated documentation files (the "Software"), to deal
'# in the Software without restriction, including without limitation the rights
'# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
'# copies of the Software, and to permit persons to whom the Software is
'# furnished to do so, subject to the following conditions:
'#
'# The above copyright notice and this permission notice shall be included in all
'# copies or substantial portions of the Software.
'#
'# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
'# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
'# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
'# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
'# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
'# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
'# SOFTWARE.
'
'##################################################################################




--- End code ---

B+:
Thanks Rick, it is just my code!

Here are my results with same. You can see why I am shocked at your results.

Rick3137:
 It's not good and I sometimes wonder if their isn't some unknown programmers if the security field, taking shots at Basic. >:(

jj2007:
@B+: Which Windows version, which CPU, which graphics card?

I have a simple i5 with a standard Nvidia... and 100 circles take 20ms

Rick3137:
   There might be something about Windows10 that does not like Mark's SDL algorithms.
   I tried it with the original fillcircle command and got 688 ms.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version