Fbc compiler benchmark

Post your FreeBASIC source, examples, tips and tricks here. Please don’t post code without including an explanation.
Post Reply
mrminecrafttnt
Posts: 131
Joined: Feb 11, 2013 12:23

Fbc compiler benchmark

Post by mrminecrafttnt »

Benchmarks your FBC Compiler.. :)

Code: Select all

dim as double runtime = timer
width 120,40
color 15 
locate 2,2
Print "FBCBench 0.1 - Compiled with:";__FB_VERSION__
color 7

dim as integer subnr,osubnr,defaultsubnr = 5000,setsubnr
setsubnr = val(command)
if setsubnr = 0 then setsubnr = defaultsubnr : print "Rendering Method = Default (Compile 100000 Sub)"
color 15 : print "Benching FBC Version:";
color 7
shell "fbc -version"
locate csrlin+1,1

open "Bench.bas" for output as #1
Print "Writeing Bench.bas.."
for i as integer = 1 to setsubnr
    subnr+=1
    print #1,"sub s";str(subnr)
    print #1,"print ""this is sub #";str(subnr);""""
    print #1,"end sub"
    if subnr = osubnr + 1000 then print #1,"#print subnr ";str(subnr);"/";str(defaultsubnr) : osubnr = subnr : print "subnr :";subnr
    
next
print #1,"#print compile select case stuff"
print #1,"select case str(val(command))"
for i as integer = 1 to setsubnr
    print #1,"case """;str(i);""""
    print #1,"s";str(i)
next
print #1,"case else"
    print #1,"#print write else stuff.."
for i as integer = 1 to setsubnr
    print #1,"s";str(i)
next
print #1,"end select"
print #1,"#print compile the other stuff.."
print "Closing file.."
close #1
print "compiling..";
print "STARTING BENCHMARK"
dim as double t = timer
shell "fbc Bench.bas"
print "done"
print using "FBC Bench used :####.####sec";timer-t
print using "This Run used  :####.####sec";timer-runtime
print "Press A KEY TO EXIT"
sleep
Post Reply