What are the advantages or disadvantages of compiling to VM Bytecode vs native machine code?

This page summarizes the projects mentioned and recommended in the original post on /r/ProgrammingLanguages

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • Oberon

    Oberon parser, code model & browser, compiler and IDE with debugger

    Compiling to native machine code has many disadvantages such as platform dependency (i.e. you need a backend per platform), much more work (you need e.g. to write the optimizer yourself, likely with different features for each platform, you have to take care of the C ABI yourself in case you need an FFI, you might require a GC, etc.) and it's more difficult to test and debug. If you on the other hand generate e.g. LuaJIT or CIL (ECMA-335) or Java bytecode, all these things are already done for you and the runtime is usually available and optimized for different platforms. If you compile to CIL you can even profit from the AOT compiler features of Mono (or the forthcoming CoreCLR). Some of the mentioned advantages are also available when you e.g. compile to LLVM IR, but the size and complexity is larger and you still have to take care of a lot of things yourself (like GC, C ABI and the like). My early compilers (see https://github.com/rochus-keller/Oberon/) generated LuaJIT bytecode, but then I switched to CIL because of the benefits and instead of an LLVM AOT compiler it write a C transpiler which was a good decision.

  • wabt

    The WebAssembly Binary Toolkit

    I think a good target would be to generate WebAssembly text format and use WABT.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

  • wasmtime

    A fast and secure runtime for WebAssembly

    With this you can run your language in the browser and on the desktop using wasmtime.

  • binaryen

    Optimizer and compiler/toolchain library for WebAssembly

    You can also use binaryen to optimize your wasm output

  • langs

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts