Slashdot Mirror


User: jtheory

jtheory's activity in the archive.

Stories
0
Comments
309
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 309

  1. Re:More comments on Eye on Java performance Improvements · · Score: 1

    I think we're actually arguing pretty close to the same thing here, for the important bits.

    But you must comment and document it very well because it is uncommon.

    This (in your words) is a big part of my main point -- if you're going to do something that might be hard for the reader to grasp, you should be aware of this cost.

    So what you are basically saying is 'nobody does it that way' so 'nobody ought to do it that way'?

    I wouldn't say "nobody should do it" -- I'm saying pretty much what you're saying -- if it's uncommon I should comment it really well, and if I can avoid it easily, I should. I even mentioned that implementing recursion as iteration can have a cost of its own -- and if that cost were too large, it would outweigh the cost of possible confusion because of the uncommon Exception use.

    I'll agree that there may be a few cases where an advanced programmer might need to reuse Exceptions to solve a sticky problem. But I still don't think that Exception re-use should be in a list of suggested optimizations for the average programmer. I've personally never had a need for this optimization (of course YMMV). Yes, I've used a SAXException to escape XML processing (like another poster mentioned), but it was never a performance hotspot (only needed to escape if the input was malformed), so there was no call for exception reuse even then.

    As far as recursion efficiency -- you will read in plenty of optimization guides that calling lots of methods in a tight loop won't scale particularly well for speed-sensitive code. If you really need to optimize a chunk of code, you will avoid recursion if possible, keep it all in one ugly method, use bitshifting instead of standard arithmetic where possible, etc. etc., and have a LOT of comments all over it so that any maintainer will have some hope of surviving in the mess. And before you did any of this you'd better have your performance profiler out to see how much each optimization actually gained you, because each one will have a big cost for maintainability that might not be worth it.

    Again, understand that I've never had to do this kind of thing (in 7 years of Java coding), and I don't even talk about these kinds of optimizations when I'm helping someone learn the language. It's much more common that the database queries need optimzation, in my experience. Optimization tachniques can be dangerous things...

    I'm not concerned about you reusing an Exception when you're optimizing some frequently used, high-performance tree search algorithm where this special use is well-commented and entirely contained. What I worry about is the developer who sees the technique in a book, and does his whole project that way because it's a cool idea and he's proud to show off his new Java knowledge.

    There are a lot of general approaches to design that will help us come up with efficient programs, that don't include possibly costly optimizations. There is a place for the more "dangerous" ones, but only after careful consideration, and when the performance of the application needs it.

    I think you'd agree with that at a high level....

    I'll agree to disagree on the idea of using pre-constructed Exceptions as a "an internal signalling device that is lightweight". Personally, I'd only use that kind of construct in an extreme case where it was required for optimization.

    Consider a program with 10 functions that call each other in turn and you realise you need to get information or a signal from the inner one all the way to the outer one; you may have to change hundreds of parts of the code. Using an exception can help localise the changes necessary.

    When I realize that I've screwed up an interface (and I need more info out of those objects than I'd realized), yeah, I change all that code. This kind of refactoring is surprisingly quick and safe now with IDEs like idea and eclipse. Besides, before I could throw that exception all the way out, I'd have to r

  2. More comments on Eye on Java performance Improvements · · Score: 4, Insightful

    ...with less attitude (sorry, somehow I'm picking up the popular slashdot i-know-more-than-god tone... gotta watch that).

    The article in question does do a good job of explaining why Exception creation is expensive.

    I'm still dead-set against reuse of Exception objects, though, for some pretty good reasons. I've seen the suggestion before, and it bothers me because as optimizations go, it's very short-sighted.

    I'm sure you've heard the suggestion to "code for the human, not for the machine", because you code *will* need to be maintained, unless your project fails. ...and you may have also heard that this is nonsense and a great way to *ensure* that your project will fail because it's unuseable.

    As usual, the best answer is somewhere in-between. Every programmer should have the human reader in mind while designing and coding, but they should *also* design for efficiency. It has to be an informed compromise.

    Reusing Exceptions is one of those examples that I like to use of how *not* to optimize. It's a basic misuse of an integral part of the Java idiom. Everyone understands how Exceptions work, and how to use the stacktraces to find your error. It's dependable. The poor sucker who's on call when a customer calls because this application keeps crashing takes stacktraces for granted, and is going to be beating his head on his desk after 2 hours trying to figure out what is going on.

    This is a big cost. Okay, sometimes a cost is worth it, in optimizations. If this is a core data-crunching library that absolutely must perform at peak efficiency, maybe this is worth the painful maintenance cost.

    In this case, though, I can't think of any benefit to balance this cost, except that a programmer somewhere is pleased with herself for using an optimization she read in a book. If this data-crunching library is throwing Exceptions left and right in its normal processing, it's using Exceptions wrong.

    I hadn't thought about using the pre-made Exception hack to escape recursion -- it seems like a quicker way to get out than unwinding the recursion, after all -- but thinking about that more, I wouldn't suggest it even then. NOTE: comments below are not performance-tested, so if you really want to use recursion in a performance-critical part of an application, you should run some tests first.

    To begin with, recursion isn't a very efficient process in Java. Each time the method calls itself, all of the current local variables are stored, a new copy of the method is made (with new locals), and execution continues in the new copy.

    When you unwind the recursion, each of those stack frames and associated variables will need to be removed from the stack/heap and cleaned up, whether you exit normally or via an Exception.

    If you do exit via a reused Exception, you're misusing the functionality (as discussed above), and the benefits -- which will be slim, if any -- aren't worth it, because there are better options.

    If you're writing performance-critical code, you should use iteration, all in one method, instead of recursion, because it will perform better than even recursion with an Exception escape (probably in this case the cost is some readability.. recursion can be much more elegant).

    If it *isn't* performance-critical code, then you shouldn't be worried about unwinding the recursion. And I still don't like misusing basic Java concepts, but you could even throw a new Exception to escape w/o worrying about performance -- after all, 1 million new Exceptions in 10 seconds is still pretty darn fast when you're only talking about throwing one.

    -----
    Wow, I hope someone reads this... it was a lot of work to write out!

  3. Sure, just call time-out! on In-Flight Reboot? · · Score: 1

    If the foe is watching closely enough, he should see the pilot making a "T" with his hands.

    Who would ignore an internationally-recognized symbol such as that?

    I would imagine they have the fighter equipped with a loudspeaker as well, so the pilot can should "game on!" when he's back online.

  4. Yeah, yeah on Eye on Java performance Improvements · · Score: 2, Interesting

    I was summarizing quickly (yes, I know it's the creation that's costly) -- the point is that these are details about the language that any Java developer probably already knows or can intuit.

    I just wanted to warn off experienced developers who were expecting the "serious investigation" that was promised in the posting.

    By the way, I would NOT suggest reusing Exceptions. What you should strive to do is ensure that, in normal usage of your application, Exceptions will not be thrown (hence your program will be operating at peak speed). When there are errors, though, throw Exceptions then -- because it doesn't help anyone for your app to speedily come to a false result because the errors was eaten somewhere along the way.

    I.e., don't throw Exceptions as part of parsing user input -- it's part of your application's job to check input and report faulty entries to the user. You're handling it. BUT you probably should throw an Exception if a file you are using disappears.

    A slightly better example -- if you wrote a SETI-at-home style application that checked if data was within certain bounds, it would be bad to have a method that threw an Exception when data was outside those bounds... and just keep catching those Exceptions until you found the data you wanted.

    Sounds stupid, but newbies do this kind of thing sometimes as a simple way to bail out when you finish processing early in the method body.

  5. "Level: Introductory" on Eye on Java performance Improvements · · Score: 4, Informative

    Level: Introductory
    Just a note -- don't bother reading if you've ever looked into Java tuning before.

    I admit I only skimmed the article... but the tips I saw are all simple suggestions that have been around for years now.

    Use Jikes for quick compilations? Jikes has been around since before the Java 1.2 days.

    Only throw Exceptions in "exceptional" cases, because they will slow things down? Again, advice I've been hearing since the early days.

    Nary a word about exploiting the new IO classes, or evaluating performance of XML vs. custom formats, etc. etc.

  6. Avoid shade? Hm. on Hyperion Rover, 1 km On One Command · · Score: 2, Funny

    One of its prime objectives was to plot courses that avoid shade

    I hope they find it another way to navigate before they send it out to rescue lost hikers in Death Valley, etc..

    - "Oh, thank God you found me, RoboSaviour!"
    - "YES MY SECOND PRIME DIRECTIVE IS TO HELP HUMANKIND. DO NOT FEAR I WILL CARRY YOU TO A HOSPITAL ESTIMATED TIME TO ARRIVAL 62 HOURS"

    - "Wait, second directive? And, uh, wouldn't it be safer for us to travel at night?"
    - "HERE WE GO, SIR. ESTIMATED ARRIVAL CONDITION: TENDER, EXTRA-CRISPY"

  7. window? on Emergency Cooling with Limited Power? · · Score: 1

    Have you ever seen a server room with a window? The general idea is, you want an environment that's as controlled as possible, which means no windows, and if possible, no shared wall with the outside of the building (isolation that usually works out nicely, until you have no reliable power to control the environment in the room...).

    Besides, if they had a window, I don't think they'd need to punch holes through a wall to put in any kind of localized A/C.

    They might be able to spread some of the heat into the rest of the *building* with fans (I don't think anyone's working there anyway, since they have no lights!)... but probably not enough to keep up.

    Personally, I'd like to find out why the original problem can't be solved. Is the power company just planning on leaving things in the current useless state all summer? You might just want to relocate your servers to another hosting center in the meantime (...how small a host are you?).

  8. Talk about FUD machine... on SCO Awarded UNIX Copyright Regs, McBride Interview · · Score: 1

    Why does Yahoo just print the press release as if it were news? Sure, the mention that the source is SCO, but I didn't notice that right away... and was shocked when I started reading stuff like this as if it were fact:

    Hundreds of files of misappropriated UNIX source code and derivative UNIX code have been contributed to Linux in a variety of areas, including multi-processing capabilities. The Linux 2.2.x kernel was able to scale to 2-4 processors. With Linux 2.4.x and the 2.5.x development kernel, Linux now scales to 32 and 64 processors through the addition of advanced Symmetrical Multi-Processing (SMP) capabilities taken from UNIX System V and derivative works, in violation of SCO's contract agreements and copyrights.

    Yoicks.

  9. Re:Mozilla, you let me down on Nationwide Class Action Filed Against DoubleClick · · Score: 1

    Yep, I have AdAware installed on her computer, and I just run it every once in a while to clean up whatever nasties have managed to get on.

    Seems to work pretty well, but -- to get back to the topic a bit more -- it still isn't right that the doubleclick ads (and many others, some much sketchier!) can so easily take advantage of regular home users.

    What do you do when an alert dialog pops up, if you aren't one of those "advanced" computer users? You just click whichever button seems most likely to let you move on and view the website you're trying to view, or install the program you think you want to install, etc., etc.

    Obviously, education of users also helps, and there are some people who just shouldn't be using computers, like some people shouldn't be driving cards, or carrying around large amounts of cash.

    It's a bad idea to try to protect *everyone* (you starting getting into the realm of suing McDonalds because the coffee was hot). But practices that are blatantly designed to part fools from their money should be fair game for legislation and lawsuits.

  10. Re:What does it do on Dancing With A Smart Robot · · Score: 4, Funny

    when your hands start to wander during the slow sets ?

    Simple, standardized, easy-to-program response... except it sure hurts a lot more when the hand slapping your face is fashioned from sheet metal.

    I guess they could try to program it to handle responses *other* than slapping... but that would be a lot more work, would require new hardware (and software?), and probably isn't the expected response anyway for the average guy who... well, to put it nicely, dances with robots.

  11. Re:Why not set up a local Proxy? on Nationwide Class Action Filed Against DoubleClick · · Score: 1

    Actually, my router lets me block selected addresses (or I could map them to 127.0.0.1 in the HOSTS file)... I haven't gotten around to it yet.

    Good point, though - she doesn't need to switch from IE.

  12. Don't joke; it happens on RFID Tags on Mach3 Razorblades Snap Your Photo · · Score: 1

    Not unless you maul the package, take out the rfid chip, and hide it in your sock.

    Don't be so quick to rule out this kind of thing. I just read an article the other day about a man who did
    exactly that.

  13. Mozilla, you let me down on Nationwide Class Action Filed Against DoubleClick · · Score: 2, Funny

    Just think, if I hadn't blocked images from all of doubleclick's servers, and disabled those popups... I might be in for some money! Curse you, Mozilla!

    I don't have the background to comment on the legitimacy of this suit -- but I sure am curious to see how it plays out, since I have always hated the deceptiveness of those ads. My wife gets fooled occasionally, and I have to clean all that Gator crap off the computer *again*. If only she'd swear off IE for good....

  14. Detailed chart for June on Top Five Reliable Providers · · Score: 1

    Here's the link to the page filtered for June, that lists the stats you're looking for.

    The top-10 ranked servers look like this:
    FreeBSD (x5)
    Linux
    Solaris 8
    Windows 2K
    Solaris 8
    Windows 2k

    Though FWIW, I agree with many of your reservations about drawing too many conclusions from these data.

  15. NEW fantasy light? on Biblically Themed RPG Discussed · · Score: 2, Insightful

    Oh, so they want to "show known events in a new, fantasy light."

    For a lot of people, that's not a "new" light in which to view events like the parting of the red sea, the Creation, etc. etc..

    The Bible is a collection of stories gathered over thousands of years, some drawn from different cultures and myths of earlier religions. The different elements of the Creation story are almost all drawn directly from the Creation myths of cultures that existed long be Judaism. Some of them certainly had some basis in fact, somewhere along the way... but not most.

    No, the Song of Solomon is not about Jesus' loving relation to the Church. It's poetry that was included because of its cultural value. No, there was no flood that wiped out ALL LIFE on Earth except what was in Noah's boat (though there may have been a big flood).

    I have no problem with people seeking wisdom in the Bible; there's a lot of stuff in there, and some of it is bound to be helpful. Jesus (from what we can tell) had some interesting ideas.

    Ah, that's enough ranting. Anyway, I can't imagine a way to cast this game to make it acceptable to any mass audience. People tend to be very specific about their faith -- and some will be offended by the idea that some gamer can play Jesus, some will be offended by variations in the game from the "official" script, and some will simply shy away from religious overtones.

  16. Note the promises in the article on What is Open Source? · · Score: 2, Insightful

    This made me squirm a little:
    Open Source software has the following characteristics, some of which are not usually found in legacy commercial software:

    # Control resides with the user
    # Highly stable
    # Proven security
    # End-User input to evolving functionality
    # Excellent quality
    # Highly flexible
    # No or reduced License Fees
    # No vendor lock-in
    # Self-determined upgrade path
    # Can run on less expensive hardware
    # Very cost-effective
    # Freedom of vendor choice
    # Fast development cycles
    # Ongoing evolution.


    Wow, all open source projects have these features? I think it's important to let managers out there understand that there *are* some high-quality OSS projects out there, but it's not nice to just ignore the fact that most OSS work is crap.

    Sure, you can find 300 projects in SourceForge for any given need... but most of them are still in the concept phase, or comprise a few crappy pieces of code that are currently running on a single teenager's home server.

    I just tend to think it doesn't help anyone to present such a one-sided viewpoint.

  17. Dubya? Is that you? on Linux Router Project Dead · · Score: 1

    make no mistake about it

    Ugh. That phrase still gives me chills. How about "let's look at what we know".

    There is definitely *value* in building a solid online rep (and more and more employers are googling interviewees), and you can improve your skills, which may help you land that job... but in today's world fame is still NOT bankable.

    Some employers will be encouraged by your thriving OSS project.. and some will simply see it as a massive leech sucking away your productive time (which, in all honesty, might be true).

    Paychecks from a solvent company are bankable. I think it's great when we can do both, but it's simply not worth it for everyone.

  18. The key point here on Anarchy Online Gamer Responds · · Score: 4, Insightful

    ...and even though I wasn't having any fun

    This is the most important line in the post. Something is wrong when you're driven to keep going, but *you aren't having any fun anymore*.

    I have a personality type that makes this kind of addiction very easy. My first experiences with computer games were the early *text* adventures -- Adventure, Zork, and others (xyzzy, maze of twisty passages all different, etc.).

    Before I knew it, I found myself glaring red-eyed at the computer screen as the sun came up, surrounded by maps, notes, etc., feeling sick and aching all over. I wasn't playing because I was having fun -- it was frustrating as hell. I felt horrible. But I was going to figure out every last puzzle if it killed me. I felt like the game was a malevolent being fighting against me.

    Nowadays, I just don't start playing the games. I don't own any (though I did once spend a dozen hours or so honing winmine strategies before I realized what I was doing).

    I have similar rules in other aspects of my life. I never ever gamble (not even penny poker). It just sucks the fun out of it for me, because I feel like I have to win, and I can't enjoy the game.

    I was an athletic kid in school, but I ran track instead of playing basketball, or football, or any game like that where there's more personal interaction and physical contact. Yeah, you can get spiked or elbowed in a race, but running a good race involves self-control much more than exerting your will over the other runners.

    There isn't anything specifically wrong with playing a game for hours on end, especially a game where you're interacting with other live players, if you're enjoying it. It can be one form of social interaction, or just like watching TV but more interactive. It's when you're harming your own well-being (mental or physical) and you still can't stop that you should get a clue that something is awry.

  19. Priorities on Paying for Volunteers? · · Score: 1

    I agree with the post above; this is scary.
    "by its completion", you "hope" to have a deal?

    The obvious worst case in that scenario would be horrible... what happens when the game is finished, and the developers have been paid, and Vivendi says actually, no, we talked about this with our lawyers again and decided we can't license this to you; sorry about that.

    I won't say the project is doomed, since you still can work this out... but I do agree that I would never contribute to this project until that issue was resolved. Personally, I think it's more than a little dangerous to put anything more than a few days worth of work (let alone cash!) into the project before you have this worked out.

    Please, no matter how friendly the person you talked to at Vivendi was, anything they say is meaningless until you have worked it out. More than likely they honestly *thought* it would be fine, but they hadn't thought through the details, talked with the lawyers, etc. etc. and you're going to get screwed.

    Don't let it slide! You need to get something *on paper* from Vivendi as soon as you can. Without that, you should keep in mind that every hour you spend working on the project might easily be a waste.

  20. Come on, come on... on Three LindowsOS PCs Reviewed · · Score: 1

    So, wait, is Slashdot in Greek or English again?

    Any second now someone's going to post:
    "Well, it's all Greek to me".

    It's gotta happen. I've seen this all before.

    Oh, wait. Damn; it was me.
    Then I apologize.

  21. In other news... on Weta Prepares to Render LOTR: ROTK · · Score: 2, Funny

    ... spare cycles before rendering began have been applied to the SETI @ Home project.

    One week into this endeavor, alien life was successfully created (and beautifully rendered).

  22. no, very sophisticated ispell on Three LindowsOS PCs Reviewed · · Score: 4, Informative

    It also apparently lacks Ispell.

    Sure, the *English* word is panacea.

    But the GREEK word that panacea is derived from is "panakeia" -- spelled as in the posting -- meaning (like the English word) a cure-all.

    I am not making this up:
    http://dictionary.reference.com/search?q=pana cea

  23. Rose-colored glasses on Executing a Mass Departmental Exodus in the Workplace? · · Score: 2, Insightful

    Talk about a major case of rose colored glasses. When these wonderful managers mismanage the company into the ground, then ask me to clean up their mess, should I?

    Ah, that cursed optimism of mine. Just can't shake it.

    The funny thing is, though -- it can work. If you just scheme against management, they will know it and not feel any compunction at all about giving you the boot.

    If you try to work with them (and yes, maybe help them clean up the mess, but also help them prevent it from happening again), it might not work (and you can usually figure out pretty early on if it's failing, and bail before you get yourself into trouble!) ... but then again, it might.

    There are companies where the intelligent, considerate but persistent person can really get ahead. There are companies where s/he doesn't have a snowball's chance in hell. Start slowly to find out where you are... and if you're the snowball-in-hell, you can either start stabbing backs and scrabbling, or just lay low, wait out the poor economy, and move on when you can.

  24. Communicate, people! Communicate! on Executing a Mass Departmental Exodus in the Workplace? · · Score: 5, Insightful

    Neither of these is a good answer at this time!!

    Maybe the description of the situation left some things out... but this really seems like a big case of an "us against them" failure of communication. Notice this bit: "You get the feeling that the company is just going to take advantage of you no matter how and what happens." Feelings, huh? You don't know what's going on or why, but you have these feelings?

    There is no "company", a single malevolent entity that is treating you like dirt. There are a lot of individuals involved in the decisions to ask more hours of you, put you on call w/o extra compensation, etc.. Right now, one of your managers is probably talking to his superior, saying "well, I guess we could ask W and X to handle those few extra on-call hours... it sure sucks, but they seem to be okay with the increases so far, and someone has to do it. That should keep customers Y and Z with us, so we'll be okay on payroll through this quarter, at least."

    Do you get it? You have to ASSUME that everyone is on your side from the very beginning, and start talking to your manager, their manager, etc.. Let them know that you and the other grunts are starting to give under the strain. Find out what the problems of the company are, and talk about how the company is dealing with them.

    Important: approach everything with a friendly, "we're all doing what we can" attitude. As soon as you get hostile, whoever you're talking to will get an uncontrollable urge to dig in their heels. Instead, decide where your breaking point would be, and discuss it reasonably ("if this happens, I'd really have to leave, and neither of us wants that to happen"). You are NOT making threats. Make this clear. Explain that you will keep your manager informed as the situation evolves, and that you will not leave without warning.

    If you start getting frustrated with anything other than the economy, calm down and pick up the conversation later.

    Bottom line: decide what kind of sacrifices this company is worth to you, and get in on the big picture.

    Good luck.

    --
    "Everything should be made as simple as possible, but not simpler". - Albert Einstein

  25. Sheesh. Not everyone WANTS it. on Putting the TV Broadcast Spectrum to Better Use? · · Score: 1

    I only watch TV 1-3 hours a month. I could afford cable without breaking the budget, but I still haven't signed up.

    Maybe if I had access to the better programming that cable occasionally offers on one of the 5-6 channels that people actually watch, I would watch more TV... but why the hell would I want to watch more TV? I have little enough spare time as it is. Won't I get more out of going on a long walk with my wife and the dog than I will watching... well, anything?

    Yes, we still watch movies, but we pick them out, and rent them, we don't just watch whatever happens to be showing.

    I'm not really sure if I'd miss free TV if it went away. I get my news online (wow, there's a lot more out there than what FOX says), but of course that isn't a viable option yet for a lot of people.