Comments (4)
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.
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.
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.
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)
- Add .d.ts HOT 8
- Waiting for subscriber to finish executing HOT 1
- Allow passing array of subscription tokens into unsubscribe
- Allow subscribing to multiple topics at once with same callback HOT 1
- Import vs window - unpredictable publishers HOT 5
- countSubscriptions always returns 1 HOT 4
- getSubscriptions wrong result
- use it in react hooks Why are requests repeated HOT 3
- PubSub does not work under Context API HOT 4
- Add "files" field in package.json HOT 1
- PubSub keep using the initial state value in .subscribe() - ReactJS HOT 4
- Any tests examples approach on this library? (with React) HOT 2
- Add the possibility to await sync events (publishAwait) HOT 3
- I can't subscribe event while publish any topic, in different controller
- Rename "PubSub" variable for multiple instances HOT 1
- Feature wanted - RegExp HOT 1
- clearSubscriptions would clear different topics which includes the same string
- ReadMe points to wrong jsdelivr package HOT 5
- Publish Latest value HOT 2
- Wildcard support for subscriptions? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pubsubjs.