Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9082681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:36:59+00:00 2026-06-16T20:36:59+00:00

I am building a library which augments the standard JS input events. This means

  • 0

I am building a library which augments the standard JS input events.

This means firing off a great many events for multiple touches at input sampling rate (60Hz) in the browsers of ARM devices.

I have looked at this jsperf and it produces about 250,000 ops/sec on my 1.7Ghz Sandy Bridge i5 and I will test my iPhone5 and Nexus7 on there shortly.

My question is will an unlistened-to event be processed quickly?

Also is there a way to skip processing for generating an event if I know the event is not being listened to?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T20:37:00+00:00Added an answer on June 16, 2026 at 8:37 pm

    I think that jsperf muddies the waters when it comes to dispatching and handling events because event listeners are also added and removed every test loop iteration. It sounds like your use-cases have high-frequencies of dispatching and handling events, but comparatively low demands for adding and removing event handlers.

    I put together a jsperf that focuses on wrapping a native event with a custom event and then disatches the custom event. The test scenarios are based on:

    • Presence or absence of a listener for the custom event
    • Immediate vs lazy initialization of data associated with the custom event
    • The impact of the above factors when dealig with “light” vs “heavy” intitialization demands

    To test the “heavy” vs “light” initialization demands, each custom event creates an array of either 10 or 1000 random numbers.

    Regarding lazy initialization of custom event data:

    • When a listener was present, the lazily init’d event was usually a bit slower. For “light” data it was sometimes as low as 0.8x the speed of the immediately init’d event.
    • Without a listener, the lazily init’d data was usually faster for both “light” and “heavy” data. For “heavy” data, it was generally 2x-10x faster.

    My question is will an unlistened-to event be processed quickly?

    In everything I’ve seen, an unlistened to event is always processed faster than an event that has an associated handler. But, I think this will only have a large impact if the event handlers, themselves, are rather slow and costly. Also, the higher the cost of creating the custom event the less this will matter if the custom event is created either way.

    Also is there a way to skip processing for generating an event if I know the event is not being listened to?

    Two things come to mind:

    • Expose the knowledge of whether the event is being listened to or not to the process that generates and dispatches the event, and then have that process skip creating the event if it knows nothing is listening.

    • Sounds like the code that generates the custom event will, at some point or another, listen for a native event and then create a custom event(s) based on the native event. In this scenario, you could ignore the native event until an event listener for your custom event has been added, and then ignore the native event again when all listeners for the custom event have been removed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a library which contains a lot of wrappers for various bits
I'm building modular application with 2 modules which share common vo: ShopRegionVO This vo
I'm building a library for conversational natural language processing . In many ways it
I'm building my own JSP Tag Library which need to support some features that
We are building a web app library which need draw some polyline/polygon/circle/rectange. Also we
Under Mac OS X 10.6 I am building a C++ shared library which links
Im building a book library which handles Books and Journals. I have a winform
I'm having a class library which is getting referenced in a web application. This
We have a reusable library which gets delivered across to multiple products. Most of
I'm building a class library which references a file in its working directory. However,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.