Git Product home page Git Product logo

Comments (3)

cosmos72 avatar cosmos72 commented on May 22, 2024

Two very relevant questions, that I already pondered in the past. Thanks for asking them :)
They are quite different, so let me answer to 1. here, while I answer to 2. in #43:

The main problem with compiling gomacro natively on low-memory systems, as Raspberry Pi, is the gomacro/imports/syscall and the gomacro/fast packages. The first links all symbols from the syscall package, and current Go compilers need a huge amount of RAM (~1GB) to compile it. The second is the interpreter itself, and compiling it eats ~1GB too. I routinely compile gomacro on Odroid C2, an ARM64 board with 2GB RAM running Linux, and it works flawlessly both in 32bit and 64bit flavors. If you can, I think adding 1GB+ swap to the Raspberry Pi and being (very) patient should be enough to compile gomacro natively.

An alternative is trying to reduce the amount of RAM required to compile it: quite straightforward for the gomacro/imports/syscall package - just split the huge init() function into a lot of small functions - but much harder for the gomacro/fast package.

Another alternative is to use the older, much slower and much smaller gomacro/classic interpreter instead of gomacro/fast: it currently misses a command-line REPL, but it's basically a matter of duplicating gomacro/cmd and replacing the calls to fast interpreter with calls to the classic one. If you are willing to work on this, I will happily accept it as a contribution.

from gomacro.

morangorin avatar morangorin commented on May 22, 2024

Thank you for the quick answer. I am using my own REPL and I did not realize that I could switch from the fast interpreter to the classic one. Except for speed, is there any feature that the classic interpreter is missing?

from gomacro.

cosmos72 avatar cosmos72 commented on May 22, 2024

Yes, I just documented the limitations in gomacro/classic/README.md. They are, in summary:

  • untyped constants and arithmetic on them, as 1<<100, are evaluated as typed constants.
  • types are not accurate when mixing untyped constants with typed values, i.e. uint8(10) + 1 gives uint64(11) instead of uint8(11).
  • interpreted interfaces are not functional (they can only be declared).
  • interpreted types cannot implement compiled interfaces.
  • struct tags are ignored.
  • support for embedded fields in structs is very limited - they mostly work as non-embedded fields.

Plus it also has the limitations of the fast interpreter listed in gomacro/doc/features-and-limitations.md

from gomacro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.