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

Intrusive storage for small structures? #3237

Closed
dabroz opened this issue Nov 8, 2016 · 1 comment
Closed

Intrusive storage for small structures? #3237

dabroz opened this issue Nov 8, 2016 · 1 comment

Comments

@dabroz
Copy link
Contributor

dabroz commented Nov 8, 2016

I am writing a game development oriented mruby gem for small vectors (primarily 4x float). I need at most 16 bytes per object to store its data.

I can use mrb_data_type to store this data, and this works fine. However I would like to avoid the extra allocation and store this data along the object if possible. Can I do it somehow? Would I need a new MRB_TT_XXX to correctly garbage collect such object?

@matz
Copy link
Member

matz commented Nov 8, 2016

Seems good idea. I will consider adding new inlined data structure.
But it would take time. Stay tuned.

dabroz added a commit to dabroz/mruby that referenced this issue Nov 16, 2016
Inline structures have no instance variables, no finalizer, and offer as much space as possible in RBASIC object. This means 24 bytes on 64-bit platforms and 12 bytes on 32-bit platforms.
mruby-inline-struct gem is only provided for testing.
dabroz added a commit to dabroz/mruby that referenced this issue Nov 16, 2016
Inline structures have no instance variables, no finalizer, and offer as much space as possible in RBASIC object. This means 24 bytes on 64-bit platforms and 12 bytes on 32-bit platforms.
mruby-inline-struct gem is only provided for testing.
@matz matz closed this as completed in 4cca8ba Nov 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants