Coder Social home page Coder Social logo

Comments (6)

IvanMalison avatar IvanMalison commented on July 17, 2024

It seems to me that we should use arrays that are definitely unboxed (so that we can load them by doing a simple memcpy), and probably storable (in case people want access to the underlying ptrs) in case people want to pass pointers to C functions through FFI.

We can add instances to IsValue for Data.Vector so that it is still possible to easily unmarshal to a normal boxed haskell vector if the user prefers that.

This approach would avoid tons of extra unmarshalling in cases where performance may be a concern.

from haskell-dbus.

rblaze avatar rblaze commented on July 17, 2024

Is there a use case for DBus where performance is a concern? I honestly don't know, my understanding is DBus used for semantically rich, but low-data interactions.

Said that, deserializing data directly to vector instead of intermediate list looks like an obvious change.

from haskell-dbus.

IvanMalison avatar IvanMalison commented on July 17, 2024

@rblaze DBus is used to communicate things like full menus which will contain several images. Image data can be large enough that it doesnt make sense to store it in lists, and doing so can significantly slow things down, so yes, I think there are use cases where performance is a concern.

from haskell-dbus.

rblaze avatar rblaze commented on July 17, 2024

Yes, deserializing without intermediate lists is good in any case. I just wonder if it worth playing with memcpy-like constructs, sacrificing readability and safety.

from haskell-dbus.

rblaze avatar rblaze commented on July 17, 2024

I took another look at this. To significantly improve performance with large byte arrays I'll need to change exposed types and marshaling code.

In this particular place, the performance hit isn't that significant: it only copies pointers to the boxed values, not values themselves. But I'll update it to use direct vector creation anyway.

from haskell-dbus.

rblaze avatar rblaze commented on July 17, 2024

On the closer look, nothing I can do there. Marshaled DBus arrays do not provide item count, the only way to know how many elements are there is to read them until data are exhausted. And vectors need to know item count in advance.

🤦‍♂️

from haskell-dbus.

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.