Generational GC and VSCode Performance Improvement: Motoko Updates

Motoko Biweekly Update Part 7!

Hey Motoko Devs!

It’s time for a new Motoko update post!

If you missed the last update post from the languages team, check it out here! Last time we talked about catching errors on message sends, and a new version of Candid.

Today we’ll be talking about generational garbage collection, and VSCode extension performance improvements! Bonus section about using GitHub copilot/GPT3 with Motoko.

Generational GC: Presentation at Global R&D!

@luc-blaeser has been hard at work over the past many months putting together a new generational garbage collector for Motoko.

And tomorrow, he will be presenting on this project live at this month’s Global R&D presentation!

When: February 22, 2023 / 17:30 CET / 8:30 PDT

Register at the link above if you haven’t already! Also, this meeting will be recorded and posted on our YouTune channel in case you can’t make the live presentation.

If you want to see detailed discussion about this feature, checkout the PR here.

See you guys tomorrow!

VSCode Extension Optimizations

The VSCode extension now runs about 10x - 100x faster on large Motoko projects!

The performance improvements come from smarter selections of which files to type check. Instead of type-checking every file in the workspace, the extension now only checks open files and dfx.json canister entry points (along with all imported files). This was also layered with other optimizations (such as caching diagnostics) to reduce the amount of messages being passed between VS Code and the language server for large projects.

This optimization is released as an experimental feature, so please let us know if you run into any bugs!

Bonus Section: GitHub Copilot x Motoko

Recently, I’ve been playing around with GitHub’s generative AI coding tool called GitHub Copilot, at the suggestion of @kpeacock. The tool is a wrapper around GPT3, a predecessor model to the recently famous ChatGPT. As you type code, Copilot will anticipate your intentions, and non-intrusively suggest syntax that you can seamlessly accept or reject as you work. I’ve found it to be very useful in increasing my development speed, even with a new language such as Motoko, for which the model would presumably have little training data. I thought I’d share my experience here in case you guys find it useful as well.

Find the tool here: GitHub Copilot · Your AI pair programmer · GitHub

Note that the tool may be collecting data on your repository/code so please consider this before using the tool, especially for non-open source projects.

Till next time!

– DFINITY Languages team


Excited for the Motoko updates in this week’s Global R&D! Incremental GC is :fire:

I’ve really noticed the recent performance improvements in the VSCode Extension - a huge load off, so thanks for that.

Also, a big +1 to using GitHub Copilot with Motoko - it’s pretty incredible once you get going with it. Funny enough, Copilot is a pretty huge memory hog, so I have to turn it off every once in awhile as it starts to get pretty laggy (but is great when it doesn’t lag). @rvanasa A lot of the time I find that Copilot is fighting with VSCode suggestions in general, but I’m curious if there are any features that the Motoko extension could hook into Copilot that would supercharge development.


Apologies! The presentation tomorrow will be about the generational GC. Please see updated PR link in the original post


On it! :wink:

@chenyan and I are both trying various AI + Motoko experiments behind the scenes, which we hope to eventually package into an official product if something works especially well.