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

Support for object-array #113

Closed
isaksky opened this issue Oct 9, 2018 · 3 comments
Closed

Support for object-array #113

isaksky opened this issue Oct 9, 2018 · 3 comments
Assignees

Comments

@isaksky
Copy link
Collaborator

isaksky commented Oct 9, 2018

I'm seeing if I can make nippy work with datascript without having to take a slow / inefficient approach, and object-array seems to be among the types that are stopping things.

Does this sound reasonable to add support for? If so, should it get its own set of type ids like byte arrays do? (E.g., objects-[0, sm, md, lg]?)

Btw, I see that int-arrays work, though I couldn't immediately see how (there is no [I class check like how there is a [B check for byte arrays). Is it via java serialize, edn, or something else?

@ptaoussanis
Copy link
Member

ptaoussanis commented Oct 9, 2018

Hi Isak,

I'm unfortunately not familiar enough with Datascript to be sure what you mean by "work with" in this context, or what the various possibilities are.

But assuming there's a decent motivation for supporting object array serialization, I can comment on the id set question. The value of the [0, sm, md] prefixes is strictly as a space micro-optimization for common collection types (esp. when the collections are typically small).

One reasonable option would be to just to define a single object id type, implicitly as type lg. It'll be a little space inefficient for small arrays, but probably not to any degree that matters.

If there's ever a motivation to further optimize the space usage, you could introduce the other variants in a non-breaking way by just renaming id-object to id-object-lg at that time.

Does that make sense?

I'd probably prefer that route, just as a safe way of gauging demand for this type.

Btw, I see that int-arrays work, though I couldn't immediately see how (there is no [I class check like how there is a [B check for byte arrays). Is it via java serialize, edn, or something else?

Not sure off hand. You could check the byte-array sequence to identify the type id being used.

Hope that helps!

@isaksky
Copy link
Collaborator Author

isaksky commented Oct 10, 2018

Makes complete sense, thanks!

@isaksky isaksky self-assigned this Oct 10, 2018
isaksky added a commit that referenced this issue Oct 10, 2018
@ptaoussanis
Copy link
Member

Great, merging manually in a moment- thanks Isak!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants