Coder Social home page Coder Social logo

Comments (4)

mroderick avatar mroderick commented on June 10, 2024

Thank you for your input, I am also working on another way of speeding things up, so hopefully I can combine the two, and get significant speedup.

I am currently trying to isolate the slow parts in my other attempt at speedup, in order to prove if it's even worth doing.

I'll leave this ticket open for further discussion until there's a conclusion to the investigation.

from pubsubjs.

mroderick avatar mroderick commented on June 10, 2024

As far as I can tell from the code example, it just breaks the execution chain for the first message, after that it's still using synchronous delivery, which kind of defeats the point of async delivery.

I am closing this, please reopen if I've completely misunderstood the example

from pubsubjs.

grignaak avatar grignaak commented on June 10, 2024

Perhaps I am misunderstanding what you mean by asyncronous delivery. I interpreted it as not "blocking" the execution of the caller of publishAsync. To this end, this is a fast implementation because it avoids the overhead of setTimeout as much as possible.

You may be worried because the event pump calls publishSync. I believe I just extracted the common code from the asynchronous and synchronous version, and it happened to be the entire synchronous version. But the "event queue" guarantees the same ordering as calling setTimeout for every publishAsync.

But, if you mean by asynchronous that it doesn't block the graphics/Ajax processing then you have a few options. You could discard this code and stay with the costly setTimeout per publishAsync. Or you could add a limit to the processing done within the event pump; i.e. after n messages or m milliseconds, reschedule the event pump (setTimeout) to take care of the rest of the work later.

from pubsubjs.

mroderick avatar mroderick commented on June 10, 2024

For the sake of completeness, I've fixed the broken last version on jsPerf:
http://jsperf.com/pubsubjs-vs-jquery-custom-events/43

from pubsubjs.

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.