Author Topic: The integer Mandelbrot bench  (Read 13844 times)

0 Members and 2 Guests are viewing this topic.

JRS

  • Guest
The integer Mandelbrot bench
« on: April 12, 2014, 08:14:59 AM »
Quote
Scriba           681.86 seconds   ??       scriptbasic.com

Hi Ed,

Would you mind posting the Script BASIC code for your benchmark? I would like to try your code on Windows 7 as a 64 bit application. (not in the 32 bit emulator all the other tests were run under)  Are there any other BASIC languages on your list able to run native 64 bit on your box?

Quote
As they say, take this with a grain of salt!

I'm happy you added that disclaimer because your Script BASIC results are off by ~ 680 seconds.

I would appreciate if you would correct the errors in your post on BP.org.

1. Change Scriba to Script BASIC.

2. The open source project site for Script BASIC is www.scriptbasic.org not Peter's static archive of his early work on the scriptbasic.com site. You are pointing people to OLD code that more than likely no longer works on todays OS platforms.

3. The ?? should be replaced with ANSI/ISO C.

A bit further down in the post ...

Quote
Scriba         BASIC interpreter

Please change to ...

Script BASIC - Embeddable multi-threaded scripting API with a traditional BASIC enhanced syntax.

Thanks in advance for correcting these errors.

John Spikowski
Script BASIC Project Manager (since 2006)

@Mike - I didn't see a FBSL entry in Ed's list.

« Last Edit: April 12, 2014, 04:02:37 PM by John »

Ed Davis

  • Guest
Re: The integer Mandelbrot bench
« Reply #1 on: April 19, 2014, 02:20:48 AM »
Quote
Scriba           681.86 seconds   ??       scriptbasic.com

Hi Ed,

Would you mind posting the Script BASIC code for your benchmark? I would like to try your code on Windows 7 as a 64 bit application. (not in the 32 bit emulator all the other tests were run under)  Are there any other BASIC languages on your list able to run native 64 bit on your box?

I'm happy you added that disclaimer because your Script BASIC results are off by ~ 680 seconds.


Nope, I get about the same time every time I run the benchmark.  While having lots of neat things to offer, it is somewhat slow, compared to other interpreters.  At least on my machine.

The code is almost identical to that used for the other BASIC interpreters.  Here it is:

Code: [Select]
accum = 0
count = 0
while count < 1545
    left_edge   = -420
    right_edge  =  300
    top_edge    =  300
    bottom_edge = -300
    x_step      =  7
    y_step      =  15

    max_iter    =  200

    y0 = top_edge
    while y0 > bottom_edge
        x0 = left_edge
        while x0 < right_edge
            y = 0
            x = 0
            the_char = 32
            x_x = 0
            y_y = 0
            i = 0
            while i < max_iter and x_x + y_y <= 800
                x_x = (x * x) \ 200
                y_y = (y * y) \ 200
                if x_x + y_y > 800 then
                    the_char = 48 + i
                    if i > 9 then
                        the_char = 64
                    end if
                else
                    temp = x_x - y_y + x0
                    if (x < 0 and y > 0) or (x > 0 and y < 0) then
                        y = (-1 * (-1 * x * y) \ 100) + y0
                    else
                        y = (x * y \ 100) + y0
                    end if
                    x = temp
                end if

                i = i + 1
            wend
            accum = accum + the_char

            x0 = x0 + x_step
        wend

        y0 = y0 - y_step
    wend

    if count % 300 = 0 then
        print accum, " "
    end if

    count = count + 1
wend

print accum


Mike Lobanovsky

  • Guest
Re: The integer Mandelbrot bench
« Reply #2 on: April 19, 2014, 04:41:36 AM »
@Mike - I didn't see a FBSL entry in Ed's list.

Hehe John,

I am not a retro-BASIC type of guy so I am not registered at that forum. Yet I do skim through their content occasionally to amuse myself with funny things that are happening there from time to time. :)

JRS

  • Guest
Re: The integer Mandelbrot bench
« Reply #3 on: April 19, 2014, 09:04:20 AM »
Quote from: Ed Davis
While having lots of neat things to offer, it is somewhat slow, compared to other interpreters

Thanks Ed for posting the code. I see now where the problem is. You didn't use the Mandelbrot iterator function in SB. My test with well over twice the number of iterations per pixel results in a just over a second in execution time.  (yours = 200, this example = 510 iterations per pixel)



Code: [Select]
' ScriptBasic GFX - Mandelbrot

IMPORT gfx.inc

s = gfx::Window(640,480,"ScriptBasic GFX Mandelbrot")
ts = gfx::Time()
FOR y = 0 TO 479
  FOR x = 0 TO 639
    cx = (x - 320) / 120
    cy = (y - 240) / 120
    rit = gfx::Mandelbrot(cx, cy, 510)
    gfx::PixelRGBA s, x, y, rit * 12, rit * 8, rit * 4, 255
  NEXT
NEXT
te = gfx::Time()
gfx::stringColor s, 20, 15, "Time: " & FORMAT("%.4f",(te-ts)/1000) & " Seconds." & CHR(0), 0x000000ff
gfx::Update
WHILE gfx::KeyName(1) <> "+escape"
WEND
gfx::Close

I could convert the above to return the results you're looking for but I don't see the point just to prove you're mistaken about Script BASIC being slow. Script BASIC has one of the best extension APIs going which uses C BASIC for ease of use.

I have noticed that Script BASIC WHILE/WEND is noticeably slower then FOR/NEXT. I try to avoid using WHILE other than for small loops.

Thanks for your efforts and if you could correct the post(s) on BP.org and your misleading statements, that would be great!

 
« Last Edit: April 19, 2014, 07:31:37 PM by John »

Aurel

  • Guest
Re: The integer Mandelbrot bench
« Reply #4 on: April 19, 2014, 02:16:57 PM »
John
How you espect that we can try your SB gfx mandelbrot example when
scriba or scribaw ( win32) version not work by drag & drop source file
into interpreter exe.
I only see that output window flash and close  :o
I look into allbasic forum and into scriptbasic forum and download latest release
but nothing ?

PS.heh even i can force my toy interpreter with mandelbrot function which
he can execute in less than a second

JRS

  • Guest
Re: The integer Mandelbrot bench
« Reply #5 on: April 19, 2014, 02:45:48 PM »

Still running XP ?

SCRIBA is a console mode interpreter example of the Script BASIC API. It allows redirection which comes in handy when used in a batch/shell script. I'm not aware of any other console mode languages that allow drag and drop functionality. The scribaw (now called sbiup.exe) is a Windows application and has no console support. It still requires you to pass the name of the script you are going to run as an argument. I hope that cleared things up for you.

Quote
I only see that output window flash and close  :o
I look into allbasic forum and into scriptbasic forum and download latest release
but nothing ?

Try scriba -d alpha_circles.sb and see if it shows a missing dependency. Are you running SB 2.2? You could always insert a PRINT "Got Here\n debug statement in the code and see how far you get. Script BASIC wouldn't even start if the program had errors in it. It sounds like you don't have the SDL_gfx.dll in the search path so Windows can find it. Is your scriba.conf file working? What do you see when you do a scriba -D?
« Last Edit: April 19, 2014, 06:57:17 PM by John »

Mike Lobanovsky

  • Guest
Re: The integer Mandelbrot bench
« Reply #6 on: April 19, 2014, 06:09:32 PM »
John,

I'm also running XP now as you may see from my current IP data on your server and I'm planning to do so for a long time to come. While my dev platform is Windows 7 since April 8, I'm going to support XP in my products as long as it doesn't interfere with the main functionality of FBSL. BTW such support is still a must in many a contract that I work under as a freelancer.

XP is not a curse. It's been my very good companion for many years and I'm sorry to see it go. I saw only one crash of XP in over six years and that was caused by a broken boot sector in one of my older hard drives.

Happy Easter! :)
« Last Edit: April 19, 2014, 08:26:50 PM by Mike Lobanovsky »

Aurel

  • Guest
Re: The integer Mandelbrot bench
« Reply #7 on: April 19, 2014, 09:58:46 PM »
John
You can see what i have in SB2.2 folder on C disk and nothing work.
And why not work by drag & drop ?
is this really to tuff to implement that for you? ,or is this impossibile ?

 And yes what is wrong if some of us use XP.
I will try to modify my ASciEdit to work with SB2.2 and then i will try...

.

JRS

  • Guest
Re: The integer Mandelbrot bench
« Reply #8 on: April 19, 2014, 10:09:45 PM »
Q. After opening a Windows console and sitting at the C:> prompt, what happens when you type in scriba -D?

A. If Windows says that scriba isn't a valid command, you didn't add the Script BASIC bin directory in your search path. If scriba says it can't find its configuration file with the -D option then that needs to be set up.

I wrote a fairly detail manual install for Script BASIC 2.2 on the www.scriptbasic.org/forum (downloads - sticky 2.2 release) that should be simple enough for anyone to understand even if English isn't your primary language.

@Mike - Maybe I'm too close to SB to see what Aurel's issue is. Have you had any problem getting Script BASIC working on Windows?

Aurel

  • Guest
Re: The integer Mandelbrot bench
« Reply #9 on: April 19, 2014, 10:21:47 PM »
John
SB interpreter ( even is console based) must respond on Shell api
shellExecute, so when i modify my editor i will try..ok

JRS

  • Guest
Re: The integer Mandelbrot bench
« Reply #10 on: April 19, 2014, 10:24:01 PM »
Why add another layer to your problem. Are you afraid of the console window? Please try the test I asked you to and let me know what happens.

Mike Lobanovsky

  • Guest
Re: The integer Mandelbrot bench
« Reply #11 on: April 19, 2014, 10:51:06 PM »
@Aurel:

1. How come your screenshot shows two files called "scriba.conf" in one and the same directory? :o Go to the Windows Explorer settings (they should be somewhere near your main menu settings on right-clicking the Start orb IIRC) and make it show filename extensions and hidden and system files and everything else. It's supposed to be a coder's PC, after all, not a lamer's one. ;)

2. No, ShellExecute() will only work if:

2.1. The ".sb" document's MIME type is bound with the Scribaw executable.

2.2. All the paths for the SriptBASIC installation are properly written to the Windows environment variables.

2.3. ScriptBASIC doesn't require special or particular options to launch a .sb script for execution.

3. Try to do what John says in the following sequence:

3.1. Copy your test script to the C:\SB22b2_Win32\bin directory.

3.2. Open up your console.

3.3. Type "c:" then type "cd c:\sb22b2_win32\bin". This will make this directory your working directory. Simple browsing it in the Explorer doesn't work for the console.

3.4. Type "scribaw your_test_filename_with_extension_here" to launch the script file for execution.

3.5. Always change your console path to the working directory before issuing any console commands on any platform you use.

@John:

Was I correct with the last command here? Please correct me if not. I'm currently under Mac OS X and can't check it "live".

JRS

  • Guest
Re: The integer Mandelbrot bench
« Reply #12 on: April 19, 2014, 11:03:46 PM »
You're right about associating .sb with scriba.exe and running the scripts by clicking on them in explorer. Don't forget a LINE INPUT at the end of your code or the console will close as soon as the script finishes.

Lets assume Aurel installed Script BASIC in the C:\scriptbasic directory. He should use the advanced feature in System (control panel) and add C:\scriptbasic\bin to his search path. At a minimum, you need the paths to C:\scriptbasic\include\ and C:\scriptbasic\modules\ defined in the scriba.conf file. (and compiled with the scriba - k option.

The gfx.dll goes in the modules directory. The gfx.inc goes in the SB include directory and the SDL_gfx.dll goes in the Windows\System32 directory on XP (SysWOW64) if on a 64 bit Windows OS. SDL 1.2 DLL must be there as well.

Mike Lobanovsky

  • Guest
Re: The integer Mandelbrot bench
« Reply #13 on: April 19, 2014, 11:18:51 PM »
Hey-hey-hey-hey!

AFAIR scriba is not the executable to run on Windows. The Windows executable is scribaw.exe and it has a proper Windows icon embedded. His Explorer, as a minimum, fails to display .exe and .bak extensions. Else how could there be two scriba.conf files in one and the same directory???

Also, his .sb documents are not bound to any executable at all - their icons are pure text files otherwise they'd show a small SB emblem on top of the paper sheet icon.

My guess is he just copied his \bin directory from some other location.

Aurel my dear, this won't work! Make a clean re-install of SB on your new "Vista" or we're gonna get real old before we see you start your first SB test… :)
« Last Edit: April 19, 2014, 11:40:18 PM by Mike Lobanovsky »

JRS

  • Guest
Re: The integer Mandelbrot bench
« Reply #14 on: April 19, 2014, 11:26:27 PM »
Quote
we're gonna get real old before we see you start your first SB test

 ;D  ;D

Good-Night folks.