Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

I asked Fastest way to sort integer arrays in JavaScript soliciting a fast JavaScript sorting algorithm implementation. I was very descriptive, provided an example benchmarking HTML with a fast Radix Sort already implemented, and made it clear that I was interested in code not theory.

I've seen plenty of questions with bounties that solicit fast running code, but somehow my question was closed because

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form.

It appears that down-voting an answer from a user with community clout incurs the wraith of other users with some prominence. So much so that a wrong answer was voted up despite probably containing wrong information.

This is probably just unnecessary venting, but what did my question lack that caused it to be closed?

  • edit * Thanks for all the great feed-back. The main issues seemed to be that my question was too verbose and restrictive. People didn't want to read the whole thing nor did they appreciate my goal of finding just fast running code.

Also the (wrong) answer referring to using the built-in JS array.sort to sort integers is still being voted up. Very humorous but also sad.

  • edit 2 * I was unaware that down-voting someone made you their life long enemy. This topic is as answered as it's going to get. The comments made for an interesting meta discussion.
share|improve this question
Given that all of the users who voted to close your question have over 10k rep, and the only two people who posted answers have 900 and 2500 rep, I very much doubt that the close votes were a result of you offending someone or "incurring the wrath" of high-rep users because you downvoted someone's answer. More likely, the question's you're looking at as examples are all old questions asked before the guidelines were as firmly developed as they are now. – Cody Gray Aug 19 '11 at 11:46
Here's a recent question asking for a fast memory copy algorithm, very similar to mine (only it had a +500 bounty).… – Louis Ricci Aug 19 '11 at 11:57
It actually had four +500 bounties; Adam Davis was mainly trying to give away reputation. But there's still a big difference between his question and yours. Namely, his question is about the algorithm. Yours basically asks people to write the code for you. People don't really like that kind of question around here; reminds them far too much of plz give me teh codez! – Cody Gray Aug 19 '11 at 12:01
I think your insistence of code only, everything else be damned, could be a bit offputting to people. Sometimes help comes in different forms, and you could get two theory answers that you can put together for a good solution (no guarantees of this, of course). It's kind of like someone panhandling and only taking $10 bills, if you'll excuse a rough analogy. – jonsca Aug 19 '11 at 12:02
Cody Gray, seems that's the case; I thought someone would have a fast implementation on hand that they would be willing to share. Indeed jonsca, my attempt to streamline the answers clearly came off badly. – Louis Ricci Aug 19 '11 at 12:10
Bad attitude + plz give me teh codez + open ended = bad question for SO. If you don't feel like your question is too open-ended, I have some code you can parallelize for me... but I want only code, and for it to run as fast as possible. That should be pretty easy to answer. – Patrick87 Aug 19 '11 at 14:09
@Patrick87: I don't understand why you're holding such a grudge? Is one down-vote that terrible for you. As I said on the original question let it go... You're starting to stalk me. – Louis Ricci Aug 19 '11 at 16:02
I have to agree with @jonsca. Often times, your reject a $20 because you're only looking for a $10. I'm guilty of that too, both with SO and irl; I think we all are. A few things I notice between your post and the post you linked is: 1) he's willing to accept pseudocode/algorithms. 2) he identified a need to increase speed before he asked (I didn't see anything in your post that said "I'm using ___ but it is performing slowly, and I need to speed it up." 3) Any code they provide that says 'this is fast' will be a personal anecdote, which you specifically asked to not get. – corsiKa Aug 19 '11 at 17:35
.. continued .. Now I'm not saying this to rub anything in on you, because that's not my style. I'm just saying it because I identified those as reasons why that one post you linked would be generally accepted and yours kind of fell flat. And if at all possible, I'd like to help future questions... well, not fall flat :-) – corsiKa Aug 19 '11 at 17:36
@glowcode: 1) What he asked, and the accepted result (actual c code) seemed to diverge, so if I only lied in my question and put a substantial bounty... 2) Two quotes from my question "...I'm under the impression that Radix Sort is the fastest..." "I'd like fast running implementations of sorting algorithms..." 3) You're confusing the definition of "anecdote" with "subjectivity" ( --a story or something regarded as unreliable. If someone says "this code is faster" and present you with the actual code you can test this and verify it's reliability. – Louis Ricci Aug 19 '11 at 18:09
.. continued .. I'm interested in how you would have asked my question. The goal being to get a generally accepted fastest integer sorting algorithm implementation for JS. While "generally accepted fastest" is fairly subjective I think prefacing it with runs faster than others on all/most of the popular browsers is reasonable. – Louis Ricci Aug 19 '11 at 18:27
@LastCoder I think the fact that what that guy asked for and what he got diverged is a good thing: it shows he had an open mind for a solution he didn't exactly consider. As for your quotes, again you're not stating a problem to be solved. How fast is fast enough? Did you benchmark and determine default isn't fast enough? And I am not confusing the two: the definition I would use for anecdote is found at "a short, obscure historical or biographical account." In practice, a single unexplained data point that is erroneously extrapolated into an actual pattern. – corsiKa Aug 19 '11 at 20:25
.. continued .. and the way I would have asked it is: "I'm working on a new Foo system that requires me to do sorting on the client side. I've been using the default implementation, but it isn't performing to my needs. For datasets of 1m or more, it's taking XYZ seconds to perform the sort, and my requirements explicitly state that it must be ABC. How can I make this sort faster?" If you'd like to talk about it further we should probably take it to chat (which unfortunately I can't really do until I get home from work). – corsiKa Aug 19 '11 at 20:26
I was unaware that down-voting someone made you their life long enemy. This is quite clearly false, and even if it were true, it's just another reason/benefit of the fact that downvoting is completely anonymous. – Cody Gray Aug 20 '11 at 5:21
up vote 4 down vote accepted

Your question was clearly detailed and showed effort. I'd say you met all of the requirements under

What kind of questions can I ask here?

Your problem was the next section:

What kind of questions should I not ask here?

You should only ask practical, answerable questions based on actual problems that you face.

I think your question was iffy by this standard. I think it's obvious the built-in sort is the practical way to sort in JavaScript.

Chatty, open-ended questions diminish the usefulness of our site and push other questions off the front page.

I don't think "open-ended" is a very clear rule, but you could have golfed this indefinitely (you used a superlative, "fastest", in your title), so the question could have been considered open-ended.

Your questions should be reasonably scoped. If you can imagine an entire book that answers your question, you’re asking too much.

"Write me a fast sort / Which sort is fastest" has many books written about it. This is again iffy.

If your motivation for asking the question is “I would like to participate in a discussion about _”, then you should not be asking here. However, if your motivation is “I would like others to explain _ to me”, then you are probably OK. (Discussions are of course welcome in our real time web chat.)

Your motivation also seemed to be "I want to shoot down your sorts" not "Please help me improve my sort". Your statements about specific things not to do and arbitrary limitations on the answers you wanted, as well as your general attitude, back this up.

Five different people thought your question failed at least one of these criteria, so it got closed. I probably would not have voted to close, but I would not have answered, and would probably have posted a comment explaining that I thought you should rework your question.

share|improve this answer
The "built-in" sort in JavaScript doesn't sort integers unless you pass it a comparison function. My benchmark HTML (in my question) demonstrated this; it was slower. My motivation is "someone share some fast running JS sorting code". While the question heading was vague I outline the specific use cases I was looking for. – Louis Ricci Aug 19 '11 at 12:05
I'm just trying to explain the reasons other people might have voted to close. If what you say about the built-in sort is true, you should have lead with that in your title or a TL;DR at the top of the question. That way, other people would have known you had a legitimate reason to want a faster sort. – agf Aug 19 '11 at 12:08
You also should have just ignored micro-optimizations and loop unrolling if you weren't interested, or just added a comment that that wasn't what you were looking for to those answers. By banning them in the post, you made your post less practical and more of a code golf -- if you really had a real world problem, as specified in the FAQ, you wouldn't care where the speedups came from. – agf Aug 19 '11 at 12:10
Micro-optimizations and loop unrolling are very hardware specific optimizations, not really suitable for a scripting language. Also I qualified that portion of my question with (yet) meaning that once a fast and stable implementation was found then some micro-optimizations might be appropriate. – Louis Ricci Aug 19 '11 at 12:14
@LastCoder: Generally, "optimization" questions aren't really suitable for a scripting language. If you care that much about optimization, you've probably chosen the wrong language. – Cody Gray Aug 19 '11 at 12:16
@Cody Gray: if you run the benchmarking HTML presented in my question you would see that optimization (or even just choosing the right algorithm) can vastly improve the running time of a script. Considering JavaScript is evolving very quickly in terms of speed (JIT and engine optimizations) your generalization is quickly becoming obsolete. *Also, the use-case of 50,000-2mil array length (stated in my question) seems to warrant optimization. – Louis Ricci Aug 19 '11 at 12:19
@Last: There's a big difference between "code optimization" and "choosing the right algorithm". Your question asks for the wrong one. – Cody Gray Aug 19 '11 at 12:20
You tried to set rules for your question. Generally, that doesn't work. The person who asks the question sets the goal, and the only rules are the rules of Stack Overflow. You treated the question as if it belonged to you; once you ask a question it belongs to the community. You give it away both legally and ... I can't think of the right word ... something like morally when you post it here. – agf Aug 19 '11 at 12:21
@agf, clearly the community did not want to come to a definitive consensus about the fastest integer sort implementation for JS. I thought stream-lining the question would help reach the goal faster, obviously my assumption was wrong. – Louis Ricci Aug 19 '11 at 12:24
Yes, I think that's right. This isn't a convention, so the goal is not to reach community consensus on technical questions, but provide people the tools and help they need to solve their real word problems. You're also right about the second part, your assumption that you could keep control over the question in order to guide it to a conclusion was incorrect. That's not how SO works. – agf Aug 19 '11 at 12:29
@agf: seems there's sentiment that my question isn't a "real world problem", despite the fact that I'm looking for code and placing a definitive use-case on it. Would framing my question so that it's rooted in some specific real world scenario have made it that much more palatable? – Louis Ricci Aug 19 '11 at 12:43
I think the style, attitude towards answers, and restrictions on what you considered acceptable optimizations were the main issues. Also, you were asking for a lot -- if you want a lot, offer a big bounty. Don't expect so much if you're just asking a normal question. Keep in mind I only answer Python questions, and the javascript community might have somewhat different opinions. – agf Aug 19 '11 at 12:50
Also, you're going to be fighting a bit of an uphill battle if you want to improve the question to get re-opened, or write a new, better, different question on the same topic. If you do start a new one, acknowledge the old one, and be clear about what is different / more in line with the rules. Post a comment here whatever you do and I'll vote to re-open or come by and check out the new question. – agf Aug 19 '11 at 12:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .