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 7509935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:04:24+00:00 2026-05-29T23:04:24+00:00

i have read articles that say: using the prototype will be fastest since functions

  • 0

i have read articles that say:

  • using the prototype will be fastest since functions declared are shared. more detail was explained in this article where tapping JS native prototype will increase performance as compared to using ‘improvisions’.

  • closures should perform worse since each creation of it returns a separate copy of a set of functions and variables.

  • objects (functions) are sort of closures but with this. has access control (public/private). they’re supposed to be better than closures.

  • object literals (the one looking like JSON) act like objects but have no sense of privacy. they are comparable to static methods in JAVA. i have no article to refer, i just included this for comparison.

i was testing a simple comparison of the 4 methods using jsperf in building “Classes” before i proceed with my project and i was looking forward to prototypes winning. however, closures beat them hands down. how come? is there some give and take here? unseen bias?

i may not be new to JS, but i’m totally new to these optimization concepts, please bear with me. i’m still studying about these things.

  • 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-05-29T23:04:26+00:00Added an answer on May 29, 2026 at 11:04 pm

    It’s not a given that “closures should perform worse”. Closures cause each object to get their own copy of the function. But as long as you have enough memory, that shouldn’t cause any real performance issues. If anything, closures may even be faster because they don’t have to go up the prototype chain to find the property, they are always at the first level right on the object.

    The real downside to closures is memory usage, not speed. When creating a ton of objects, it can become a concern.

    You also have to consider the runtime in question. Different JavaScript engines will optimize for different situations, depending on what they thought was most important.

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

Sidebar

Related Questions

In many of the articles I have read on the web say that when
I have read from some article that say's Apple doesn't approve the application which
I am new to ASP.net MVC architecture. I have read in some articles that
I just got Delphi 2009 and have previously read some articles about modifications that
I have read a lot of articles on developing classes (I am using php),
I've read several articles and posts that say that lock(this) , lock(typeof(MyType)) , lock(a
Let's say we have a project that will handle lots of data (employees, schedules,
I have read multiple articles about why singletons are bad. I know it has
I have read some articles on POCO in the enttity framework but still don't
I have read a lot of articles on Dependency Injection as well as watched

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.