Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #16201
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail |
|---|---|
| From | Stefan Weiss <krewecherl@gmail.com> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: silly question on closure |
| Date | Thu, 27 Sep 2012 21:29:06 +0200 |
| Organization | albasani.net |
| Lines | 37 |
| Message-ID | <k429e2$1rj$1@news.albasani.net> (permalink) |
| References | <a9704993-d83a-4392-8a65-82755e9ba320@u15g2000yql.googlegroups.com> <k3kocg$8ok$1@news.albasani.net> <7227299.QoKgMUOf8L@PointedEars.de> <k40fod$k2d$1@news.albasani.net> <3738235.beI7O1F77D@PointedEars.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.albasani.net HSxOURMs4No+V7eY4Py8q2y4E6LTtgb/VqaolfBYJDviLIsPcVA6klBfZt2uftkGp7hjAA8/NfGUpZSbAAocFiX0O9gLhIcSBilE5sEwuAQ/WcG9jzmsuj6WM2rSm5cP |
| NNTP-Posting-Date | Thu, 27 Sep 2012 19:29:06 +0000 (UTC) |
| Injection-Info | news.albasani.net; logging-data="ORwvJhZrYsKFHzMM56yJHMl3T90P65aoXiFuYlyOf0/fbbVT7dLq6mUhwQ8pLHrynmfIZw2BpaMxo+iOJ+VOpRgDOnvG04PHlCEgIJkoBqZ+BDVxjTPlbmVu+zTJYG/y"; mail-complaints-to="abuse@albasani.net" |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0 |
| In-Reply-To | <3738235.beI7O1F77D@PointedEars.de> |
| Cancel-Lock | sha1:eqK+w081owzCRwE0PlaCoyDcP14= |
| Xref | csiph.com comp.lang.javascript:16201 |
Show key headers only | View raw
On 2012-09-27 20:50, Thomas 'PointedEars' Lahn wrote:
> Stefan Weiss wrote:
>> In the vast majority of cases, JS performance is not a problem
>> (anymore).
>
> You are very much mistaken.
So you actually believe that, today, JS performance is a problem in the
_vast_ _majority_ of cases? That's funny.
> I have disputed your assertion that closures are to be avoided with a two-
> line function because they would not be worth it in any case.
I'm not surprised that you found something to dispute; seems to be a
hobby of yours. Next time, maybe dispute something I actually said?
When I wrote that the non-closure variant would be better suited, I was
not talking about "in any case", I was referring to one specific
example. Here's that function again:
function digiName (n) {
var names = ['zero','one','two','three'];
return names[n]; // fixed from alert()
}
This is obviously from an exercise, and not from performance critical
production code. Do we really need a closure here? And assuming this
function is not called thousands of times in a loop (a fair assumption
for this type of training exercise), would you really prefer a closure?
If you do, then that's nice for you, but it's a matter of personal
preference, at best. The result would be harder to read, take up more
space, and the difference in performance would be hardly measurable.
But dispute away, if it makes you happy.
- stefan
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
silly question on closure justaguy <lichunshen84@gmail.com> - 2012-09-22 05:04 -0700
Re: silly question on closure Stefan Weiss <krewecherl@gmail.com> - 2012-09-22 18:18 +0200
Re: silly question on closure justaguy <lichunshen84@gmail.com> - 2012-09-22 18:41 -0700
Re: silly question on closure Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-24 01:10 +0200
Closures (was: silly question on closure) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-24 13:14 +0200
Re: silly question on closure Stefan Weiss <krewecherl@gmail.com> - 2012-09-27 05:04 +0200
Re: silly question on closure Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-27 20:50 +0200
Re: silly question on closure Stefan Weiss <krewecherl@gmail.com> - 2012-09-27 21:29 +0200
Re: silly question on closure "Tom de Neef" <tdeneef@qolor.nl> - 2012-09-22 20:00 +0200
Re: silly question on closure justaguy <lichunshen84@gmail.com> - 2012-09-22 18:42 -0700
Re: silly question on closure justaguy <lichunshen84@gmail.com> - 2012-09-23 07:31 -0700
Re: silly question on closure Stefan Weiss <krewecherl@gmail.com> - 2012-09-23 18:49 +0200
Re: silly question on closure justaguy <lichunshen84@gmail.com> - 2012-09-23 13:33 -0700
Re: silly question on closure justaguy <lichunshen84@gmail.com> - 2012-09-23 13:38 -0700
Re: silly question on closure Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-24 20:49 +0200
Re: silly question on closure Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-24 01:14 +0200
Re: silly question on closure dann90038@gmail.com - 2012-09-23 15:37 -0700
csiph-web