What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 133 Stack Exchange communities.

Usually when I have a question that I cannot find the answer to by searching for it, it is utterly misunderstood. Example: Today I asked why the proxy pattern was so slow in java, in the case of wrapping tiny methods, as done in real programs (not microbenchmarks). There are several problems with this question:

  • If you use a microbenchmark, it's simple enough for Hotspot to figure things out and it not be slow.
  • Proxies only add significant overhead if the wrapped methods are tiny, which they usually are not.
  • Saying something that sounds anything like "known good practice is bad" makes me sound like a clueless newb, and people respond to that without reading the question deeply enough to see that it's actually "in certain edge cases, known good practice is bad. Why?"
  • I neglected to initially provide any reference for my seemingly absurd claim. That was just dumb of me.
  • It's a question about performance. The typical SO user is (reasonable) virtually allergic to such questions, since new programmers ask OH SO MANY premature-optimization questions.
  • I remember thinking of more problems. But I don't remember what they were =(

Is there any way I can ask unintuitive questions like that and get an answer instead of being turned away frustrated?

share|improve this question
3  
One big problem with this specific question is that you made an outrageous performance claim, and people immediately tried to prove it wrong. Perhaps if you showed some code that clearly demonstrated the problem? I see you've edited in a link citing the original claim, in which it talks about taking fifty times longer at the scale of nanoseconds. –  Charles May 8 '11 at 15:45
1  
@Charles: Right, that was one of the major problems. Two, I think... adds those into post. And re the scale of nanoseconds: 500ns times 10 million calls of the method is pretty big =) –  vuntic May 8 '11 at 16:03

3 Answers 3

Is there any way I can ask unintuitive questions like that and get an answer

Yes, try to read it from a reader's perspective. Make it intuitive, and if you make strong claims then provide strong evidence.

You kind of answered your own question here:

since new programmers ask OH SO MANY premature-optimization questions

Yours didn't stick out from that.

share|improve this answer
    
+1. Yeah... Now that people explain it, I can see why it's so lame from a reader's perspective. –  vuntic May 8 '11 at 21:20

Rather than asking a general and subjective question ("Why are proxies so slow?"), ask a specific and objective one ("What makes a proxy take 500ns?"). Plus, if you have a specific number (like 500ns) post how you got it so that others can investigate to find out the cause.

share|improve this answer

I think a primary problem with the question is well the question seemed to make some big claims, that weren't immediately backed up.

Furthermore when someone tried to run a benchmark showing the answer showing a lot of imitative and providing a real example they were downvoted, without explanation of why their answer deserved a down vote.

In your linked source it is specifically talking about a reflective proxy. I.e. using java.lang.reflect.Proxy or a subclass. If this is what your interested in then you should state it in the question. Also if memory serves from the last time I read the article there are a lot of possible explanations in the article itself.

Finally the question appeared, at least to me to be coming from someone who doesn't really understand what their claiming. It would have been useful to see the claim backed up by your own experience as it would have added an authenticity to the claim.

I think you will find there are a lot of good performance questions and answers on SO.

share|improve this answer
    
I tried to explain how it's backed up with my own experience with non-reflective proxies; specifically with java.awt.image.BufferedImage. I guess I failed. –  vuntic May 8 '11 at 22:16
    
Also, nitpick: the linked article talks about multiple methods of doing dynamic proxies, not just java.lang.reflect.Proxy. –  vuntic May 8 '11 at 22:17
    
Yes the benchmark that he ran was using a standard spring proxy. The simplest proxy is just 1 extra call on the call stack. Thats what is shown in the answers you already got. Honestly I'm trying to help here not just criticise. –  Wes May 8 '11 at 22:19
    
@Wes: reading more closely, yeah you're right about the benchmarks by the spring guy. But - the whole reason I'm asking this question is that, in practice, that 1 extra call can be hugely inefficient, and I want to know why the hell this is happening. It's bizzare and absurd but any benchmark with BufferedImage repeatably shows it. And it's not just BufferedImage, but all the other examples I have are internal to the project I'm working on. –  vuntic May 8 '11 at 22:35
    
Try posting a code example that shows this. Best suggestion. –  Wes May 8 '11 at 22:38
    
@Wes: Thanks for the help =) I'll do that sometime soon. –  vuntic May 8 '11 at 22:44

You must log in to answer this question.

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