Git Product home page Git Product logo

bonobo-js's People

Contributors

f5io avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bonobo-js's Issues

promises?

It would be nice if the run method accepted a callback or returned a promise so that associating calls and emitted events could be abstracted away. This was easy enough to do in a wrapper, but it would be a nice feature of the library itself. It there and I'm missing it? And if not, would you accept a pull request around that?

remove the need for Bonobo to be loaded through a <script> tag

It seems that Bonobo expects to be loaded through a <script> tag, so that it can import itself to worker scripts. But this is not documented. It's also unfortunate, because I concatenate all my .js files into one. And even if I make an exception for Bonobo, the main script would have to be in the server's root to have the bonobo-path resolve properly.

If I understand Bonobo's principles correctly, you should be able to do away with this restriction. Could you put Bonobo's code inside a function, and then use .hoist to get it into the workers?

At the very least, it would be useful if I could manually specify the path where the lib could be found.

Crashes when page URL contains '/' after the hash (#) or querystring (?)

Line 92 contains the following statement:

    _.loc = d.location.href.substr(0, d.location.href.lastIndexOf('/'));

This assumes the last '/' symbol represents the folder name. This is an incorrect assumption. I worked around this problem with the following code:

    _.loc = d.location.href.split('#')[0].split('?')[0];
    _.loc = _.loc.substr(0, _.loc.lastIndexOf('/'));

Not the most elegant, but gets the job done. If you can come up with a better solution, more power to ya!

How to use transferable objects efficiently?

I've tried to send JSON-like objects from a worker thread to the main thread using Bonobo. This still seems to take up to 10 seconds for large arrays. I profiled my app, and nearly all of this time is used by Bonobo function _self.messageHandler.

Question 1: The Bonobo docs claim that Bonobo intelligently uses transferable objects to make the transfer more efficient. From what I've been able to figure out, however, objects are translated to ArrayBuffers, which are then transferred, when are then translated back to their original form. Is that correct?

Question 2: From what I understand of web-workers, there is native support for copying JSON objects from thread to thread, using structured clone. Is this 'transferable-object-inbetween' approach really more efficient, given that it requires two translations, one of them in the main thread?

Question 3: What sort of data does Bonobo accept to actually get the (near) zero transfer time promised by transferable objects? If I send a raw ArrayBuffer, will it send it directly, or still try to copy? What about an object that contains raw ArrayBuffers?

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.