Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More builtin types #91

Open
konsumlamm opened this issue Jan 16, 2025 · 1 comment
Open

More builtin types #91

konsumlamm opened this issue Jan 16, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@konsumlamm
Copy link
Contributor

It would be nice to have proper support for Float, Double, Int64 and Word64 (the other IntN/WordN types too, but those can be reasonably well simulated).

As far as I can tell, the reason they are currently not supported is that cells in the runtime store their data in a (union the size of a) machine word, so supporting 64 bit values would mean that the data field takes 64 bits even on 32 bit platforms, increasing the needed memory by a factor of 1.5 (unless we come up with a different representation). Other possibilities would be to use a pointer indirection for 64 bit values (but that would be slower) or to somehow store them in 2 cells?

@augustss
Copy link
Owner

Yes, it would be nice.
Supporting the 64 bit types on 32 bit platforms could be an option in config.h, with a 50% increase in memory consumption if you opt in.

In general, there are two reasons to want Float over Double on a 64 bit platform:

  • faster arithmetic
  • less memory consumption

For MicroHs I don't think the first point makes much of a difference, since there is so much other overhead.
The second point would only make sense if MicroHs had unboxed vectors. Currently, the memory use would be the same for Float and Double. When we get unboxed vectors, I will certainly consider Float support.

@augustss augustss added the enhancement New feature or request label Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants