Results 1 to 9 of 9

Thread: twinBASIC now has partial experimental support for optimized builds

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    4,966

    twinBASIC now has partial experimental support for optimized builds

    Thought it was worth mentioning here for anyone following developments casually rather than closely in the Discord.

    This substantially increases performance and decreases the size of the code, matching or exceeding optimized VB6 builds. Often exceeding by quite a bit; for example:

    On wqweto's Sieve of Eratosthenes (finds prime numbers) implementation, Wayne reports the following on his Ryzen 7950X (higher is better):

    Code:
    vb6(ide):                   wqweto;288;5.000;1;faithful=no,bits=8
    vb6(all optimizations on):  wqweto;1353;5.001;1;faithful=no,bits=8
    tb(debug)                   wqweto;962;5.006;1;faithful=no,bits=8
    tb(+llvm,+optimize)         wqweto;4846;5.000;1;faithful=no,bits=8
    This is triple the performance of VB6 native optimized code.

    Code:
        [ CompilerOptions ("+llvm,+optimize,+optimizesize") ]
        [ ArrayBoundsChecks (False) ]
        [ IntegerOverflowChecks (False) ]
        Private Function RunSieve(ByVal lSize As Long) As Long
            Static Bits()       As Byte
            Dim lFactor         As Long
            Dim lIdx            As Long
            Dim lCount          As Long
    
            On Error Resume Next
            lIdx = UBound(Bits)
            If lIdx < lSize Then
                ReDim Bits(0 To lSize) As Byte
            End If
            lFactor = 3
            Do While lFactor * lFactor <= lSize
                If Not Bits(lFactor) Then
                    For lIdx = lFactor * lFactor To lSize Step 2 * lFactor
                        Bits(lIdx) = 1
                    Next
                End If
                lFactor += 2
            Loop
            lCount = -(lSize >= 2)
            For lIdx = 3 To lSize Step 2
                lCount += 1 - Bits(lIdx)
            Next
            Return lCount
        End Function
      
        Public Sub TestSieve()
            Dim dblStart        As Double
            Dim lPasses         As Long
    
            Debug.Assert RunSieve(1000000) = 78498
            dblStart = Timer
            Do While Timer < dblStart + 5
                RunSieve 1000000
                lPasses += 1
            Loop
            Debug.Print "wqweto;" & lPasses & ";" & Format$(Timer - dblStart, "0.000") & ";1;faithful=no,bits=8"
        End Sub
        
        Sub Main()
            TestSieve
        End Sub
    Gains are consistently substantial over different tests. Size optimization is producing code that's usually around the same size as VB6 native, optimized exes, where before the code was considerably larger-- for the code above, it's reduced from 1320 bytes to 228 bytes.

    Here's Wayne's original announcement:

    As of BETA 363, professional/ultimate edition users can now use the experimental LLVM backend compiler for optimizing code. Currently, support is limited to just the basic datatypes of Byte, Integer, Long, LongLong, Single and Double. We are currently only shipping the 32-bit version of the LLVM compiler, so Win64 compilation is not yet possible.

    To get started, there is a new [ CompilerOptions("") ] attribute that you can apply to procedures in a standard module. The passed string takes a series of flags separated by commas and prefixed with either +/-. To enable LLVM optimized compilation of a procedure, use the following syntax:
    Code:
        [ CompilerOptions ("+llvm,+optimize,+optimizesize") ]
        [ ArrayBoundsChecks (False) ]
        [ IntegerOverflowChecks (False) ]
        Public Function Test() As Long
            Return 123
        End Function
    Please note: in future you'll be able to control these flags at the project level, and will be able to define them independently depending on whether you're building for release or for within the IDE. There are lots of features not yet supported in our LLVM compiler backend. Please monitor the DEBUG CONSOLE for error messages when you hit upon something that is not yet implemented. You'll either get a nice message in the debug console, or a hard crash

    Note that in the above example, we've turned off the array-bounds checks and integer-overflow checks, since error handling is not yet supported by our LLVM backend.


    What's definitely not yet supported: anything to do with classes, interfaces, variants, strings, or anything similar.
    What is supported: the basic integral and floating point types as noted above, arrays, global variables, UDTs, standard module function calls, and all control-flow statements (edited)

    The CompilerOptions attribute allows for passing other flags to the LLVM backend. In particular it allows us to refine the target CPU options. These are the current available flags that control target CPU instruction sets:
    +aes,+avx,+avx2,+bmi2,+fma,+fxsr,+lzcnt,+popcnt,+rdseed,+sha,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3 ,+xsave,+xsavec,+xsaveopt,+xsaves
    Exciting times... tB is really coming together towards the 1.0 level, with this work started and nearly all VB6 features supported.

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    4,966

    Re: twinBASIC now has partial experimental support for optimized builds

    Also, a very interesting related feature:



    That's the assembly code generated by LLVM in a popup that shows when you hover over the function name. Much potential.

  3. #3
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    4,898

    Re: twinBASIC now has partial experimental support for optimized builds

    Btw, TB's LLVM support landed the same day we get a new RAD Basic update regarding promised end-of-month Beta3: they are almost finished. . .

    . . . with FRX i/o but not ready to ship yet!

    RAD Basic July 2023 Status

    Hello!

    First of all, thank you for your support in the project.

    We are finishing solving the read/write issues with the FRX format. We're almost done!

    On the other hand, we are concurrently working on a set of important features for the new version of the compiler. Thanks to the implementation of enums and optional parameters in procedures and functions, we are adding new features to the runtime library.

    And the best part: the new version will be able to compile small programs created by third parties. It will compile third-party code downloaded directly from the GitHub repository. Without any modifications!

    We are polishing the set of features, so we need a few more days to ensure an stable release. It will be the best version published so far! We don't take vacations, so we'll keep working hard to make the release during the month of August.

    Stay tuned because we'll have some very interesting news.

    And once again, thank you for your support in the project.

    RAD Basic Team
    cheers,
    </wqw>

  4. #4
    Member
    Join Date
    Jul 2017
    Posts
    43

    Re: twinBASIC now has partial experimental support for optimized builds

    Impressive results, that's very exciting!

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    4,966

    Re: twinBASIC now has partial experimental support for optimized builds

    Quote Originally Posted by wqweto View Post
    Btw, TB's LLVM support landed the same day we get a new RAD Basic update regarding promised end-of-month Beta3: they are almost finished. . .

    . . . with FRX i/o but not ready to ship yet!


    cheers,
    </wqw>
    Promised end of what month? They've been posting 'last delay for prebeta3' for a good long while now...

    But hey Oh Wow they have enums too now!? I bet now they're only a few quarters away from complete Or support! Then maybe another year or two for UDTs.... a year or two after that for API calls... maybe 3-4 years after that it'll be far enough along to start the Decade of Adding UC support! Actually, the Decade of Remaining Basic Controls will probably come first.

    I know, I know, I'm not being fair, that's unrealistically optimistic. 🤣

    tB getting ready to cross the finish line in this marathon while rB is still tying it's shoes.


    Anyone who still mentions these two together suggesting they're both legitimate, non-vaporware, functionally useful VB6 replacements needs to reconsider if programming is a topic they should be writing about.. to be diplomatic lol

  6. #6
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,408

    Re: twinBASIC now has partial experimental support for optimized builds

    My FormDesigner
    Attached Images Attached Images  

  7. #7
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,331

    Re: twinBASIC now has partial experimental support for optimized builds

    Quote Originally Posted by fafalone View Post
    Promised end of what month? They've been posting 'last delay for prebeta3' for a good long while now...

    But hey Oh Wow they have enums too now!? I bet now they're only a few quarters away from complete Or support! Then maybe another year or two for UDTs.... a year or two after that for API calls... maybe 3-4 years after that it'll be far enough along to start the Decade of Adding UC support! Actually, the Decade of Remaining Basic Controls will probably come first.

    I know, I know, I'm not being fair, that's unrealistically optimistic. 🤣

    tB getting ready to cross the finish line in this marathon while rB is still tying it's shoes.


    Anyone who still mentions these two together suggesting they're both legitimate, non-vaporware, functionally useful VB6 replacements needs to reconsider if programming is a topic they should be writing about.. to be diplomatic lol
    If it is a team development, perhaps the company's main business is to develop software for the company, the RAD BASIC IDE is only amateur development, or just the author of the development.
    In this case, maybe it will take 3 years, maybe it will take 10 years to develop successfully, really can not be predicted.
    The main problem with developing an IDE is that there are a lot of problems, one problem can take three and a half months to solve, the next problem can take several months to solve.

  8. #8

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    4,966

    Re: twinBASIC now has partial experimental support for optimized builds

    twinBASIC is also a single developer, so it's an entirely fair comparison, because they're both charging for subscriptions.

    IMO, if you're asking people to give you money for your product before it's finished, that comes with a certain level of expectation of honest representation of status before you commit, and development pace once you do. tB is exceeding those expectations, rB is not even close to meeting them. Yes, timelines slip as things are unexpectedly difficult and life gets in the way, but we're talking 3 years in now. tB has slipped about a year, year and half from it's original timeline when preorders started (at which point it was already far ahead of rB), but this is reasonable... being barely beyond "hello world" after 3 years is not (again, for a commercial product taking pre-orders. If it's your hobby project you're posting for free and maybe asking for donations; fine, take all the time you want, provide whatever info you feel like. But commercial projects have the responsibility any business does. If Carles was being up front about 'hey I'm working on this in my very limited free time, it will likely be 10+ years before any serious code can run', fine, but he's not. I keep seeing content from him and people writing stories on rB grossly misrepresenting where it's at and making no mention of it's unreasonable (for commercial software) timeline.

  9. #9
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,331

    Re: twinBASIC now has partial experimental support for optimized builds

    Quote Originally Posted by fafalone View Post
    twinBASIC is also a single developer, so it's an entirely fair comparison, because they're both charging for subscriptions.

    Is there only one developer for both twinbasic and radbasic?
    Not bad for one person inventing a great product. But this is really inefficient. I wonder if it is because there is not enough funds to hire personnel?
    Or don't have a great long-term plan?

    vfb is also a product developed by one person for about 7 years. At present, the functions are large enough, and there are too many interface buttons and menus. It feels very difficult to find. There are 50 controls, sometimes I want to do a subtraction, if it can support the deletion of any menu or tab like the VB6 addin. Every menu button and control has an ID.
    Then we can redesign an IDE interface shell, which can be VSCODE/VS2022 style or VB6 style. Well done almost exactly the same look.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width