On April 23, 2021, I helped Wayne Phillips introduce the world to twinBASIC at the Access DevCon Vienna conference. I boldly predicted that twinBASIC (along with the Monaco editor) would replace VBA and its outdated development environment by 2025. With that goal in mind, this weekly update is my attempt to keep the project fresh in the minds of the VBA development community.
Every Sunday, I will be providing updates on the status of the project, linking to new articles discussing twinBASIC, and generally trying to increase engagement with the project. If you come across items that should be included here, tweet me @NoLongerSet or email me at mike at nolongerset dot com.
Here are some links to get involved with the project:
- Custom twinBASIC IDE Installation Guide (NOTE: the twinBASIC VSCode extension is under a feature freeze until 2023)
- GitHub Issue Tracker (report bugs)
- twinBASIC Discord Server (chat about the project)
- twinBASIC/VBx LinkedIn Group
LLVM Work Begins
No major releases this week, but Wayne has begun work on the LLVM. Many more details below in the Discord Chat Summary section.
AI-Generated Chat Summaries
As interest in the project continues to grow, it's gotten more difficult for me to keep up with the ongoing discussion around twinBASIC.
Since the project first debuted more than two years ago, my process has been to read every comment made about the project over the course of each week in order to put together these weekly updates.
At first, this involved reading all the comments on GitHub. When the Discord server was added, the conversational nature of that medium–along with the growth in popularity of twinBASIC itself–led to an explosion of new comments each week. In recent months, I began spending nearly two hours every Sunday just catching up on the project. (I used to follow the conversations in real time, but then I never got any actual work done.)
All this throat-clearing and navel-gazing is an attempt to explain my decision to start relying on AI when writing these weekly updates. People have very strong views about AI. While I have misgivings, I'm firmly in the camp that AI is the future, so we might as well learn to live and work alongside it rather than engage in quixotic missions to halt or slow its progress.
I've experimented with ChatGPT to summarize these conversations in the past, but it did not save me much time. The free version of ChatGPT could not handle the entire conversation at once, not to mention the fact that Discord makes it nearly impossible to copy and paste messages in bulk.
I've since found two tools that have been game-changers in terms of making this approach feasible:
Unlike ChatGPT, Claude-2-1ook allows you to attach files as part of your prompt. It also creates hyperlinks within its summary so that you can quickly ask it follow-up questions based on the context you fed it.
Discord Chat Summary
* Auto-generated via Claude-2-100k on poe.com
- twinBASIC developer WaynePhillipsEA announced he is starting work on integrating LLVM, which should bring performance improvements. Early benchmarks show 3-4x speedups on some algorithms compared to the debug compiler.
- The LLVM integration is making good progress. MD5 hash calculations showed a 4x speedup over debug mode and were on par with highly optimized VB6 code. String and variant support still need to be added.
- There was discussion around adding support for newer CPU instruction sets like SSE4 to take advantage of modern hardware. This would likely be controlled via a project-level setting.
- Contributors discussed options for adding audio playback support for common formats like MP3. This is missing from VB6 and would likely require OS-specific implementations.
- Several users asked about timelines for the LLVM integration and raising minimum Windows version requirements. The developer emphasized keeping XP/2003 compatibility for now.
- A bug with the RichTextBox control crashing on empty byte arrays in 64-bit mode was reported.
- There were several technical discussions around details of the language implementation, like supporting generics, enum descriptions, and emulating complex struct layouts.
More Details on the 4x Speedup
Here are some more details on the 4x speedup mentioned with the LLVM integration:
- WaynePhillipsEA shared some initial benchmark results comparing twinBASIC's debug compiler to an early LLVM backend implementation.
- The test was using an algorithm submitted by the user wqweto - a sieve of Eratosthenes prime number generator.
- When compiled with the debug compiler, it could perform around 400 iterations in 5 seconds.
- The same algorithm compiled via LLVM could perform around 1280 iterations in 5 seconds.
- So the LLVM version was able to run the algorithm about 3-4 times faster than the debug compiler.
- The LLVM compiled code size was also significantly smaller - 276 bytes versus 1283 bytes with the debug compiler.
- Further optimizations are expected as more data types are supported and the compiler can target specific CPU architectures.
- But even these initial results show significant performance gains are possible with the LLVM integration. The developer was targeting performance on par with heavily optimized VB6 code.
So in summary, the 4x speedup demonstrates the performance potential of integrating LLVM, even in its early stages. It's an exciting development for the twinBASIC language.
Around the Web
fafalone published a new GitHub project named UIRibbonDemos that demonstrates how to use the Windows UI Ribbons feature to add ribbons at design time to your twinBASIC projects.
The repository contains a full tutorial of the tools you need, a link to the documentation for the markup language for the .xml files that describe the ribbon, and how you get from the .xml file to the application seen above.
It's fairly simple to set up:
Private pFramework As UIRibbonFramework Private WithEvents pUIApp As clsRibbonEvents Private Sub Form_Load() Handles Form.Load Set pFramework = New UIRibbonFramework Set pUIApp = New clsRibbonEvents pFramework.Initialize Me.hWnd, pUIApp pFramework.LoadUI GetModuleHandleW(), StrPtr("APPLICATION_RIBBON") End Sub
One thing to be aware of is that this feature uses the Windows ribbon framework and not the Office ribbon framework. According to this vbForums post, there is a difference (h/t Santop):
Office ribbon addins\workbooks use the Office Ribbon (NOT the Windows Ribbon) which I only realised after posting this question and searching the subject.
The IUIFramework, IUIApplication and IUICommandHandler interfaces are all parts of the Windows Ribbon Framework not part of the ribbon that Office applications use although they look and feel very similar ... Windows Ribbon and Office Ribbon are two different animals.
Here are the updates from the past week. You can also find this information by visiting the GitHub twinBASIC Releases page.
WARNING: The following issue is present in BETA builds 202 - 362 (the latest build as of publication):
- there are known memory leaks in these versions, so memory usage will be higher than normal
- fixed: compiler crash when editing a project in x64 that contained an
Interfacedefinition with a
As Anyparam [ bclothier, discord ]
- fixed: some issues with the new paste indentation feature in the IDE [ fafalone, discord ]
NOTE: I am out of town this weekend, so I wrote and scheduled this post on Friday evening. Any new developments from yesterday or today will be included in next week's update.