Slashdot Mirror


Performance Bugs, 'the Dark Matter of Programming Bugs', Are Out There Lurking and Unseen (forwardscattering.org)

Several Slashdot readers have shared an article by programmer Nicholas Chapman, who talks about a class of bugs that he calls "performance bugs". From the article: A performance bug is when the code computes the correct result, but runs slower than it should due to a programming mistake. The nefarious thing about performance bugs is that the user may never know they are there -- the program appears to work correctly, carrying out the correct operations, showing the right thing on the screen or printing the right text. It just does it a bit more slowly than it should have. It takes an experienced programmer, with a reasonably accurate mental model of the problem and the correct solution, to know how fast the operation should have been performed, and hence if the program is running slower than it should be. I started documenting a few of the performance bugs I came across a few months ago, for example (on some platforms) the insert method of std::map is roughly 7 times slower than it should be, std::map::count() is about twice as slow as it should be, std::map::find() is 15% slower than it should be, aligned malloc is a lot slower than it should be in VS2015.

266 comments

  1. They're out there, lurking, waiting... by Anonymous Coward · · Score: 0

    THEY'RE GONNA GET YOU. Unless, of course, you use Rust. Then you are safe.

    1. Re:They're out there, lurking, waiting... by Anonymous Coward · · Score: 0

      No no no! To get around this problem you must work in Assembly or straight up binary. There is no other way. All these abstraction layers are just fucking you up. Real programmers use only the 1 and 0 keys. All the others are for comments.

    2. Re:They're out there, lurking, waiting... by omnichad · · Score: 2

      Real programmers use only the 1 and 0 keys

      Keys? Real programmers use jumper wires directly on the memory bus pins of the CPU.

    3. Re:They're out there, lurking, waiting... by Anonymous Coward · · Score: 0

      Real programmers use only the 1 and 0 keys. All the others are for comments.

      Amateur. Real programmers never write comments.

    4. Re:They're out there, lurking, waiting... by Anonymous Coward · · Score: 2
    5. Re:They're out there, lurking, waiting... by Anonymous Coward · · Score: 0

      I use an electron microscope and manually move them.

    6. Re:They're out there, lurking, waiting... by HornWumpus · · Score: 2

      Klingon coding...

      Copy con: program.exe

      Then enter structure, opcodes and data with Alt-keypad.

      Comments...where would those go?

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    7. Re: They're out there, lurking, waiting... by Anonymous Coward · · Score: 0

      #DarkMatterMatters

    8. Re: They're out there, lurking, waiting... by Entrope · · Score: 1

      Right. Rust is never accidentally quadratic.

    9. Re:They're out there, lurking, waiting... by arglebargle_xiv · · Score: 2

      It's not the use of programming languages, it's use of completely inappropriate, daily-WTF-worthy, algorithms and mechanisms. We do development that involves interfacing with various libraries and components provided by third parties, and holy fsck, it's a wonder some of this stuff works at all, let alone inefficiently. You look at some of the duct-taped-together crap that we have to deal with and in some cases literally can't see why what they're doing works, it's pure coincidence that the way they're using the APIs happen to produce an actual result rather than an error code or a hang.

    10. Re:They're out there, lurking, waiting... by syntotic · · Score: 1

      Has anyone seen my essay on the (rem) pseudo-instruction construction for comments? I omitted publishing because a previous text was gone from the forum, then the computer was stolen from me.

  2. All too true by Anonymous Coward · · Score: 0

    Too bad companies don't pay experienced programmers more than they do a freshly-graduated pimplebottom. So that's what they get.

    1. Re:All too true by Opportunist · · Score: 1

      And for nearly all applications, they don't give a shit. Computers are today faster than they need to be for nearly all applications the average office runs into.

      --
      We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
    2. Re:All too true by mcrbids · · Score: 5, Insightful

      I came here to say this, mostly.

      I *know* that there are plenty of places in our software that I could spend an hour or two, and rewrite an algorithm to run in 1/5th the time. And I don't care at all, because the cost is too low to measure, and usually, performance bottlenecks are elsewhere.

      Who really cares if I can get a loop to run in 800ns instead of 1500ns, when the real bottleneck is a complex SQL query 11 lines up that joins 11 tables together and takes 3 full seconds to run?

      --
      I have no problem with your religion until you decide it's reason to deprive others of the truth.
    3. Re:All too true by Anonymous Coward · · Score: 0

      And for nearly all applications, they don't give a shit. Computers are today faster than they need to be for nearly all applications the average office runs into.

      yeah because "the average office" is really the only thing that matters when it comes to computer performace.

      machine vision, etc. can just suck it!

    4. Re:All too true by postbigbang · · Score: 2, Insightful

      Maybe in your world, but when weighted down with sloggy operating systems and minimal memory (typical of many Windows 10 installations TODAY), code can get pretty slow.

      For a very long time now, there have been libs that add breakpoints to examine how long processes are taking, think: debug mode, that can pinpoint problem areas pretty easily. Not enough coders use them.

      It gets worse when a user has 94 Chrome tabs open, something in Office, and an AV app running.... all on a laptop whose processor speed is measured in furlongs per fortnight.

      Yeah, SOME computers are way faster, and some have been habitually overloaded with things outside of a coder's control yet their app still must perform within a "reasonable" amount of time. Blah.

      --
      ---- Teach Peace. It's Cheaper Than War.
    5. Re:All too true by Anonymous Coward · · Score: 0

      Then how long would it take to remove or replace the SQL query with something faster? You don't have to be stupid unless you want to.

    6. Re:All too true by AmiMoJo · · Score: 1

      It's not even clear if some of the stuff he says is a bug. For example, his aligned memory allocation example takes 100ns longer than it "should" when calling an Intel specific function. It's not at all clear what the Intel function does differently, if anything... Seems to be part of one of their frameworks that makes cross-platform aligned memory allocation easier.

      It may not be comparing like-for-like. I have a feeling Microsoft will respond to his bug report with little enthusiasm.

      --
      const int one = 65536; (Silvermoon, Texture.cs)
      SJW, n: "Someone I don't like, and by the way I'm a fuckwit" - AC
    7. Re:All too true by NonUniqueNickname · · Score: 5, Insightful

      Same here

      The users are getting a correct result. Good.
      The developers moved on to something else that's also important. Good.
      The machine is doing 15% more work than strictly necessary... Is it slowing down the users? No. Are we getting hammered by the electricity bill? No. Is the machine getting tired? No. So what exactly is the problem?

      Like the real Donald (Knuth) said: "premature optimization is the root of all evil (or at least most of it) in programming".

    8. Re:All too true by Anonymous Coward · · Score: 0

      What? They won't pay some guy who goes around calling his subordinates "pimplebottoms" a job to do meaningless busywork? Color me surprised.

    9. Re:All too true by Anonymous Coward · · Score: 1

      Then how long would it take to remove or replace the SQL query with something faster? You don't have to be stupid unless you want to.

      Sayeth the noob who didn't think about how long testing the change would take...

    10. Re:All too true by Opportunist · · Score: 2

      It would take as long as it is cheaper to run the inefficient query than recoding it.

      --
      We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
    11. Re:All too true by Dutch+Gun · · Score: 2

      Videogame programmers care *very much* about all these sorts of performance issues. Not coincidentally, many videogame programmers use custom containers, and nearly ALL of them use custom allocators for exactly this reason.

      That being said, not everyone programs real-time pseudo-simulations like we do. But you should very much care about ensuring the most basic building blocks of code everyone uses are highly optimized at the very least. The more often code is called, the more attention should be paid to ensuring its as optimal as it should be.

      I'd be curious to hear MS's response to these issues. It could be that there were some deliberate reasons for the choices made, or possibly some unintended consequences to the solutions offered, but it's hard to say without a fairly deep knowledge of the STL internals MS uses (based on Dinkumware, I think?)

      --
      Irony: Agile development has too much intertia to be abandoned now.
    12. Re:All too true by ElizabethGreene · · Score: 1

      Agreed. Nit-picking code efficiency is great for code reviews, but not a productive technique to improve performance. ROI says its better to find and fix the one stupid bug that profiling identifies as 70% of your latency instead of dozens with no perceivable impact.

    13. Re:All too true by fustakrakich · · Score: 2

      Computers are today faster than they need to be for nearly all applications the average office runs into.

      For nearly everything except rebooting. I still don't understand the problem. It's better than it was, but we're still back in the old days of waiting for the TV to warm up.

      --
      “He’s not deformed, he’s just drunk!”
    14. Re:All too true by ElizabethGreene · · Score: 1

      Computers are today faster than they need to be for nearly all applications the average office runs into.

      ... or the users have learned to live with it. There are a painful number of spreadsheets out there running real businesses using macros that take minutes or hours to run.

      When you can fix those to get them to run in seconds you get really popular. (Perhaps not so popular with the original "developer", but that's part of life, eh?)

    15. Re:All too true by Opportunist · · Score: 2

      Yes, ... umm... no.

      Not anymore. Yes, it still matters with high end, AAA titles. For everyone else, there's Unity. And Unreal Engine. And ... something I forgot now. Game programming used to be one of the few areas where you really needed top programmers that can come up with creative ways to cut a few extra cycles. Just think of the infamous 1/sqrt(x) hack.

      I wouldn't expect many who currently claim to be game programmers to understand it. Let alone come up with something close to it.

      Even in games, efficient code isn't the be-all, end-all anymore. Being able to "cheat" with the graphics and making low poly shit look great with creative texturing is where the money is today, it seems.

      --
      We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
    16. Re:All too true by Anonymous Coward · · Score: 0

      And shortly after, you're fired -- having reached peak value.

    17. Re:All too true by Anonymous Coward · · Score: 0

      Guess you don't like being paid well.

    18. Re:All too true by HornWumpus · · Score: 1

      libs that add breakpoints to examine how long processes are taking

      You'd think someone who's been here as long as you would have heard of profilers.

      Your first tool should be performance monitor. In my experience most slow tasks will show 0% CPU utilization for a large part of the wait. Because some coder has never heard of firing queries asynch, then doing local work while waiting.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    19. Re:All too true by ctilsie242 · · Score: 1

      I would probably say that performance is probably dead last on any software company's mind, unless something is so slow that it gathers user complaints of affects the use of a device (for example, an embedded controller in a vend a goat machine is having a software loop that fires off every five seconds, winding up taking 6-7 seconds to complete, or a daily backup taking 26-27 hours to complete.)

      Performance can always be improved, but oftentimes, it is a case of diminishing returns. In reality, it will not even be looked at, because most software, the developers are thanking their respective deities that it built, passed unit tests, and was able to be built in an executable. Stuff like security and performance... waaay low on the list.

    20. Re: All too true by Anonymous Coward · · Score: 0

      You might want to look up the definition of the word infamous.

    21. Re:All too true by Jeremi · · Score: 2

      Sayeth the noob who didn't think about how long testing the change would take...

      Agreed that replacing tested/working code with new "more efficient" code does incur a re-validation cost.

      On the other hand, that's also an argument for writing the more-efficient implementation the first time, rather than waiting until some later release. Since you know it's all going to have to go through the testing cycle at least once, why waste your QA group's time testing slow/throwaway code, when you could have them spend that time testing the code you actually want your program to contain? (Assuming all other things are equal, which they often aren't, of course)

      The shortest distance from A to B is a straight line.

      --


      I don't care if it's 90,000 hectares. That lake was not my doing.
    22. Re:All too true by postbigbang · · Score: 1

      Sure, I've heard of and have used profilers.

      But performance monitors often only give point to point execution times, not "network I/O took 3242ms") or "Auth timed out 3x" sorts of details.

      I like logs, syslogs, and other methods of determining execution problems, too, because sometimes: it's not actually the code, it's the host, the UI, the wm, the phase of the moon. Best to know.

      --
      ---- Teach Peace. It's Cheaper Than War.
    23. Re:All too true by Ginguin · · Score: 1

      The shortest distance from A to B is a straight line.

      Until a committee or management are involved. Then your straight line looks like the paths a dozen Pachinko balls take through the machine.

      Throwaway code is often rolled into prod because that's all you have time for. I wish all other things could be equal.

      --
      "Anything you say can and will be used against you in a targeted advertisement" - Adam Harvey
    24. Re:All too true by HornWumpus · · Score: 1

      You see a client sitting at 0% utilization, you click 'break all' in the debugger. You're looking at the offending block. It's real useful.

      Then you start into the logs to see how it got there, if it's not obvious.

      It's a particularly useful method when faced with unfamiliar code that is sucking big wet donkey balls.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    25. Re:All too true by Anonymous Coward · · Score: 1

      > And for nearly all applications, they don't give a shit. Computers are today faster than they need to be for nearly all applications the average office runs into.

      This is why I refuse to run the latest photoshop, MSoffice, etc. I don't need you to triple the resource bloat for features I don't care about, and to see people paid to mess with the GUI for the sake of messing with the GUI.

    26. Re:All too true by postbigbang · · Score: 1

      I like execution-time libs that give me full stats, so the database guy doesn't argue with the network guy who doesn't argue with the team that did middleware, etc etc.

      DevOps, SCRUM, and other continuous development systems often eschew this, because they're running under fire control rather than improving incrementally. This said, I've seen a few SCRUM teams that were fast and surgical and rightly proud of their work.

      --
      ---- Teach Peace. It's Cheaper Than War.
    27. Re:All too true by HornWumpus · · Score: 1

      A good team can produce results with any POS methodology, even SCRUM. Typically despite the formal methods, not because of them.

      Stats can prevent circular blame pointing? Not in my experience with the 'barely competent'.

      When network operations go from acceptable to too slow, it's been my experience that people who don't know what they are doing have been fucking with them. e.g. Six outer joins to the same table. queries that were building temp tables but nobody noticed etc. Sure sometimes the data volume has grown or you've gained a bug from a update of the underlying OS or libraries. But 90% of the time is was someone who thought something was simple, but were wrong.

      My method works when you are dropped into a project you've never touched before to firefight. Lack of symbol tables (middleware team) quickly reveals the real problem, if it's with project organization. Even in that example, you add to the middleware unit tests and are on track to a solution as quickly as possible given the constraints.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    28. Re:All too true by postbigbang · · Score: 1

      I guess the premise needs to be someone above barely competent.

      We'll agree that your method works for fire control. Projects should NOT BE fire control in most cases. Sadly, many are. While I like to be the Ross Adair of systems malfunctions, I'll also take a less stressful life. At the end of fire control, there are often a pile of ashes. It's possible to lead a long and successful life, and not deal with but a small pile of ashes. Others seem to need them for daily lunch.

      --
      ---- Teach Peace. It's Cheaper Than War.
    29. Re:All too true by TechyImmigrant · · Score: 1

      an embedded controller in a vend a goat machine is having a software loop that fires off every five seconds.

      Is 17,200 goats per day actually necessary?

      --
      I should use this sig to advertise my book ISBN-13 : 978-1501515132.
    30. Re:All too true by HornWumpus · · Score: 1

      Fires happen. Even with the best of teams. HR gets involved and a seat is filled. Six months later you get back to a block of code and WTF happened? How did this pass QA and code review?

      Nobody likes it, but I've yet to find a long term solution. I've quit, more than once, over teams being ruined by rapid growth and 'he was the best we interviewed'. Was clearly net negative worker who, at best, could have maintained some simple reports. Shouldn't have gotten out of probation, even if you accept the premise that he was the best available at hire time (which I knew to be bullshit).

      At least in one case they were punishing me for turning down a management position. If they had told me directly: 'If you don't take the job, we'll give it to Li.' I'd have mentally quit then and there, actually quit a few weeks later, once I found another job.

      More SW jobs suck than don't. Even when they don't suck initially, they often change with growth or acquisition.

      'Process immaturity model' is usually a better metric than 'process maturity model'. Even/especially in organizations that claim all sorts of nonsense about their processes.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    31. Re: All too true by Anonymous Coward · · Score: 0

      Unless the loop is for each record returned by sql, in which case it might be beneficial. Always # of exec * runtime nanoseconds.

    32. Re:All too true by K.+S.+Kyosuke · · Score: 1

      Who really cares if I can get a loop to run in 800ns instead of 1500ns, when the real bottleneck is a complex SQL query 11 lines up that joins 11 tables together and takes 3 full seconds to run?

      Sooo...rewrite the slow loop in the database server? ;)

      --
      Ezekiel 23:20
    33. Re:All too true by Anonymous Coward · · Score: 0

      The machine is doing 15% more work than strictly necessary... Is it slowing down the users? No. Are we getting hammered by the electricity bill? No. Is the machine getting tired? No. So what exactly is the problem?

      The above are questions of scale. Whether the answers are actually no depends entirely on the scale involved.

      Is it slowing down the users?

      If the operation takes 100ms - no. If the operation takes 10 hours - definitely, yes.

      Are we getting hammered by the electricity bill?

      If the program consumes 1% of the CPU on a low-end ARM chip - no. If the program consumes significant CPU time across dozens of servers - definitely, yes. If the program consumes significant CPU time on a portable device, it's noticeably eating into battery life.

      Is the machine getting tired?

      In most cases - no. If the program consumes significant CPU on servers in a data center that has barely sufficient cooling, that 15% could certainly push things over the edge and cause a runaway buildup of temperature in the middle of summer.

    34. Re: All too true by Anonymous Coward · · Score: 0

      I would like to subscribe to your YouTube channel

    35. Re:All too true by Dutch+Gun · · Score: 1

      Using a modern game engine doesn't absolve responsibility for writing good, efficient code, and even moreso like me if you ARE the one working on the engine. Plenty of studios still write and use their own custom engines.

      Optimization is still critically important. I'd argue its one of several pillars of our technical requirements. That being said, I never claimed it was the "end all be all". But yes, we actually do worry about the cost of operations like allocations, locks, or operations which enter kernel space, because of the cost of the context switch. Those things add up if they occur when iterating over the typically massive, complex data structures we tend to work with.

      But at a broader scope, "optimization" these days more typically means being smart about how you code in a real-time and occasionally memory-constrained environment rather than micro-optimization, which isn't practical for the hundreds of thousands of lines of code in modern, large-scale projects. For instance, being smart about caching both objects and data to avoid unnecessary allocations (or writing your own allocators to help with that), optimizing for multi-threaded execution, writing CPU-cache friendly code and data structures where necessary (more important than micro-code optimizations in many cases), and so on.

      BTW, this is a common misconception, but far more happens outside of the graphics sub-system that needs programmer attention. People tend to forget that most animation happens on the CPU, not to mention physics, audio, AI, scripting, resource management, and general gameplay logic.

      --
      Irony: Agile development has too much intertia to be abandoned now.
    36. Re:All too true by strikethree · · Score: 2

      Who really cares if I can get a loop to run in 800ns instead of 1500ns, when the real bottleneck is a complex SQL query 11 lines up that joins 11 tables together and takes 3 full seconds to run?

      To misquote a not-quite-famous Congress critter: A nanosecond here, a nanosecond there, eventually we are talking about real time (minutes).

      You do not exist in a vacuum. You think your application is the only one but I have hundreds of "applications", written by people just like you, who thought that the real bottleneck is elsewhere so why worry about this particular bottleneck?

      This attitude is why I can notice the delay in a particular window opening up or why I see "hiccups" in the smoothness of my screensaver.

      I am sure that numerous studies were performed to say that the user will never notice and that these "minor" delays do not affect anything... but these studies are wrong. I notice.

      (Granted, you seem to be addressing a server application where the application truly is the only application that matters, but my point about unnecessary wasting of CPU cycles still stands. Should you go to the extremes that ancient assembly language hackers used to go through to make something not possible into possible? No. Each programmer should be trying to be as efficient with CPU time as possible.)

      --
      "Someone needs to talk to the tree of liberty about its ghoulish drinking problem." by ohnocitizen
    37. Re:All too true by strikethree · · Score: 1

      Inefficiencies are a sign of incorrect modelling.
      Inefficiencies are a sign of slack coding standards.
      Inefficiencies are a sign of not knowing exactly what the code is actually doing.

      Ultimately, these all lead to errors, and when compounded across multiple running programs, will have effects that are neither predicted nor likely to be desirable.

      Your model is good:

      Is it slowing down the users?
      Are we getting hammered by the electricity bill?
      Is the machine getting tired?

      However, it lets dirty code slide into use as long as you can say, "It is slowing down the users, but they will never notice and besides, our electricity bill is not rising too much."

      Like the real Donald (Knuth) said: "premature optimization is the root of all evil (or at least most of it) in programming".

      The keyword here being "premature". Do not take it to mean optimization should never be done or even that optimization is unimportant. It is merely stating that getting optimization done before you have everything fully modeled out is a waste of time (for various reasons).

      --
      "Someone needs to talk to the tree of liberty about its ghoulish drinking problem." by ohnocitizen
  3. Slower than what reference point? by Anonymous Coward · · Score: 1

    In SW development it's easy to spot obviously dumb decisions in code and those are probably plentiful. But it's rarely as obvious what the best solution is, mostly because there's always a tradeoff. You can generally use up extra memory in order to boost processing speed (i.e. lookup tables, rainbow tables) and vice versa. This in itself means that on a machine where memory is the bottleneck (and if you exceed it you have paging and swapping on disk) the "best" solution is different than on a machine with excess memory, but a weak processor.
    TL;DR: benchmarks depend on hardware. "Best" is often unattainable in a general sense.

    1. Re:Slower than what reference point? by Nutria · · Score: 1

      Not only that, but more slowly than it should have all too often ignores sanity checks and edge case processing which slow down what would run fast 95% of the time, but breaks the other 5% of the time.

      --
      "I don't know, therefore Aliens" Wafflebox1
    2. Re:Slower than what reference point? by Anonymous Coward · · Score: 1

      None of which applies to the examples given.

    3. Re:Slower than what reference point? by Opportunist · · Score: 1

      There are usually a handful of "best" solutions, depending on your demands. There is a best solution when it comes to computing time. Another one for memory footprint. And so on.

      So you cannot find a solution that is the best in all situations. But you can determine whether a solution is not the best in any situation.

      --
      We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
    4. Re:Slower than what reference point? by Anonymous Coward · · Score: 0

      Edge cases don't make an algorithm run 3/4 slower, and intra-program sanity checks shouldn't be necessary (or ever deployed!) outside of debug mode.

      Pick a cleverer reply next time.

    5. Re:Slower than what reference point? by Anonymous Coward · · Score: 1

      This is the worst, because entire complex applications, on top of complex application frameworks, can be built and used for years before you are tasked with fixing these performance problems when one of the edge cases is finally hit. I write insurance software, and most of our clients are smallish insurance companies, who write fairly small policies. Our entire application architecture is used by dozens of clients without any issues. Then we get a client who wants to insure fleets of vehicles in Commercial Auto. Not just a couple dozen vehicles, but hundreds or thousands of vehicles. Our policy issuance process went from sub-1 second, to over 15 minutes when a policy went from a dozen vehicles to 500 in our internal testing, and the policy amendment process went from sub-1 second to over an hour!

      So I get brought in to figure out what is wrong, and end up having to do a full performance review of both the application code, and the framework code. Worst experience of my development career. Everywhere I looked there were things that had been written without any thought whatsoever to the performance characteristics of the code. Sure you shouldn't prematurely optimize, but there is a difference between optimization, and well written performant code.

    6. Re:Slower than what reference point? by ShanghaiBill · · Score: 1

      intra-program sanity checks shouldn't be necessary (or ever deployed!) outside of debug mode.

      Unless sanity checks are a bottleneck (rare) they should be left in. Users will do things to your program that you never imagined. When I deploy, I use a custom assert that emails me a stack trace and keylog on failure. That is infinitely more valuable than a useless complaint like "Your program keeps crashing for no reason".

    7. Re:Slower than what reference point? by Anonymous Coward · · Score: 0

      The problem isn't sanity checks.

      Its bad assumptions. Like cache-misalignment or TLB thrashing. The same code will run full-speed on one system but 10x slower on another with slightly different cache characteristics. Performance might even change with an upgrade to the OS or even just a system library that re-arranges memory layout in a trivial way.

      And because most programmers don't have a clue what a TLB is, much less what TLB thrashing is, not only is it un-noticed, most don't even think about the possibility when they write the code.

    8. Re:Slower than what reference point? by Anonymous Coward · · Score: 0

      When I deploy, I use a custom assert that emails me a stack trace and keylog on failure.

      Confession of a black hat who deploys keyloggers.

    9. Re:Slower than what reference point? by K.+S.+Kyosuke · · Score: 2

      Its bad assumptions. Like cache-misalignment or TLB thrashing. The same code will run full-speed on one system but 10x slower on another with slightly different cache characteristics. Performance might even change with an upgrade to the OS or even just a system library that re-arranges memory layout in a trivial way.

      That's why I'd like to see a nondeterministic compiler some day. Take dozens of good-ish but alternative decisions differently every time. I once did some very rudimentary checks with a Scheme compiler that already generated very good code but there were some weird things going on with inlining. Tiny changes in inlining thresholds were changing the performance deterministically with a factor of several. I suspected the way the code interacted with the CPU was the culprit. But since all CPUs are different (and new ones come almost every year), hardcoding the assumptions into the compiler seemed hopeless. It ultimately started looking like a solution space search problem.

      --
      Ezekiel 23:20
    10. Re:Slower than what reference point? by Xest · · Score: 1

      I disagree with rarely obvious. For example, I've inherited C# code before where the code performs thousands of type conversions in a loop - i.e. string to integer, and does so using a method that throws an exception (i.e. Int32.Parse) when there are exceptionless alternatives available (i.e. Int32.TryParse).

      In cases like this is simply obvious that the exception throwing and catching solution is wholly sub-optimal, it's performance is worse by several orders of magnitude, with no benefit to be obtained whatsoever - it's not even more readable, or more maintainble, it's just outright bad.

      This is just one example, but there are many cases I've seen over the years where there is just an objectively superior way of doing things that can save on all resources - CPU, memory, and improve by all metrics - readability, maintainability, security.

      Mostly, these problems arise because of inexperienced programmers such that an experienced programmer can implement an all-round superior solution.

  4. Stupid analogy by TWX · · Score: 2

    It's stupid to call them "the dark matter of programming bugs". We were just accustomed to this being the way Microsoft did things, not a bug, a feature.

    That stems from Microsoft, originally writing for IBM, being paid per thousand lines of code. As such it made sense that software was not written efficiently because the programmer was not rewarded for efficiency, it merely had to fit within available memory. Unfortunately it seems that this practice has not stopped given the sheer size of Microsoft operating systems relative to the amount of end-user functionality that has been added since the days of say, Windows 3.1.

    --
    Do not look into laser with remaining eye.
    1. Re:Stupid analogy by Anonymous Coward · · Score: 0

      There has been A LOT of added functionality since Windows 3.1 days! Not just changes in the UI, but changes to security, API's, and so on. Windows, and for that matter other operating systems, are far more complex than they have ever been. If anything I'd say Window's size hasn't grown that much lately.

    2. Re:Stupid analogy by Anonymous Coward · · Score: 0

      That stems from Microsoft, originally writing for IBM, being paid per thousand lines of code.

      I wonder if the Google Chrome browser is developed the same way. It would explain so much.

    3. Re: Stupid analogy by Anonymous Coward · · Score: 0

      Is this you, Steve?

    4. Re:Stupid analogy by TWX · · Score: 4, Interesting

      And yet from an end-user point of view, Windows 8 and subsequent basically headed right back to Program Manager.

      When I think back to my Windows 3.1 experience, I had a launcher in the form of Program Manager, a file tree browser called File Manager, I had the ability to run several programs at the same time, I had the ability to play video and sound including playing music from file and from CD, I could access network storage and map resources to use as if they were local, and I could even use a web browser to access the fledgling Internet. Hell, the local college was part of the Internet so I had 10BaseT connectivity to what was available at the time.

      My point is that while the back-end of 16-bit Windows 3.1 is essentially gone, the way that people use Windows operating systems is substantially similar to the way it was almost 25 years ago. Obviously particulars have changed, but when you fundamentally look at the end-user experience versus the increase in hardware requirements and the sheer size of the install base you must wonder where all that effort really went, because from the end-user point of view it's not really all that obvious.

      --
      Do not look into laser with remaining eye.
    5. Re:Stupid analogy by Waffle+Iron · · Score: 1

      There has been A LOT of added functionality since Windows 3.1 days! Not just changes in the UI, but changes to security, API's, and so on. Windows, and for that matter other operating systems, are far more complex than they have ever been.

      Possibly, but at least developers don't have to deal with the segmented memory model and other 16-bit limitations from Windows 3.1. Writing programs to run in the original 16-bit Windows API was one of the most byzantine things I have ever done.

    6. Re:Stupid analogy by Anonymous Coward · · Score: 0

      It was quite a while ago, but I once had occasion to put a trace filter driver above the Windows TCP/IP driver and log the results.
      I was astonished to discover that there were thousands of status queries for essentially the same information issued during the boot process.

    7. Re:Stupid analogy by K.+S.+Kyosuke · · Score: 1

      A LOT of added functionality

      "Functionality"... Let me know when Windows will have the same capabilities in 200 kLOCs of code that Squeak does. I wouldn't be surprised if a randomly picked source code line of the code base of an installed Windows system was simply replicating something another one was already doing, or doing something redundant in a different way. They chose to explode, size-wise, because they simply could.

      --
      Ezekiel 23:20
    8. Re:Stupid analogy by Tranzistors · · Score: 0

      You must be joking. In case you are not, what has changed over the years:

      • Security: switching between kernel modes and user modes are costly; Secure coding practices take more CPU and RAM; firewalls; encryption etc.
      • Abstraction: you don't have to configure select, which sound card the game uses. Applications used to manage system resources themselves, now kernel does that. It is obligatory for security.
      • Graphics: resolution was 800x600, images were tiny and in 256color space (HDD speeds have not significantly improved, so then it was adequate, now you have SSD disks, which makes booting fast again), terrible video codecs (which still managed to buffer most of the time), laughable 3D.
      • Useful services: automounting USB sticks, instant messaging, e-mail notifications, calendar notifications, colour corrections, system logging etc.
      • Caching and indexing: since memory is cheap, just load all the data into memory, if data is no longer used, just keep it around, since it might be used again soon.
      • Web has changed a lot recently. I personally use noscript to deal with lot of the bloat, but the web now has some perks I would not want to give up.
    9. Re:Stupid analogy by TWX · · Score: 1

      The average end user knows nothing about security, has never had to configure the sound card manually, cares about graphics only when actually trying to move backward makes it noticeable. Caching and indexing have never been end-user terms that they understand, and arguably those are only necessary because the bloat has made real-time searches almost impossibly long.

      Notifications are nothing new, and if anything has really changed it's just that the software isn't user-loaded third-party anymore. Palm Desktop could notify one of calendar stuff and task list items coming due, and if one's email client was open it would notify when new email was received.

      Auto-mounting might be the one thing that's well and truly new in what you've brought up. That feature appeared in Windows 95.

      --
      Do not look into laser with remaining eye.
    10. Re:Stupid analogy by syntotic · · Score: 1

      Sorry, but performance bug is an euphemism for: the programmer has no idea what he is doing. It is one of the conditions for good programming, that the thing be computed efficiently, as efficiently as a good programmer can make it! If it is too slow, it is badly done! It is like saying we want buildings to stay upright! If the building implodes, it was badly constructed! Who wants to save whose neck on this one?

    11. Re:Stupid analogy by Tranzistors · · Score: 1

      The average end user knows nothing about security

      Users don't think in these categories, but when malware gets into the computer, they notice and it hurts.

      has never had to configure the sound card manually

      In the years of Windows 3.1 (witch ran on DOS), we did that. Yeah, I have weird childhood memories.

      Caching and indexing have never been end-user terms that they understand

      Understood? Maybe not. But the effects are real. World without cashing is like world without SSD disks at boot time.

      Palm Desktop could notify one of calendar stuff and task list items coming due

      True. Each little notification daemon is small and doesn't eat up much space. But there are a lot of those little workers, that clog up the memory.

    12. Re:Stupid analogy by TWX · · Score: 1

      If it's any consolation I think I could still install a supported sound card through the MCI control panel in Windows 3.1. I had to do that with my Sound Blaster Discover CD 16 kit, along with the MKE-Panasonic TSR for CD drive access.

      Come to think of it, my CD drive had more capacity than my hard disk drive did at the time.

      --
      Do not look into laser with remaining eye.
    13. Re:Stupid analogy by Anonymous Coward · · Score: 0

      That's because there were many other competitors rushing to get their product to market first.

      Are you one of these new-age king coders who think one line is better than two? LOL.

    14. Re:Stupid analogy by toddestan · · Score: 1

      Apparently that's one of the reasons Windows Update is so dreadfully slow on Windows 7. svchost.exe querying the same static information over and over, millions and millions of times....

  5. There's only one solution... by __aaclcg7560 · · Score: 0

    If performance sucks, buy a faster computer. Speed covers a multitude of sins.

    1. Re:There's only one solution... by luvirini · · Score: 1

      In many simple situations, yes.

      But there are plenty of cases where you are operating on such a large scale that using programming resources to optimize performance is a a good tradeoff. As example: in one customer case a 1% total increase in efficiency maps to 5000+ euro/month in the costs they pay to host the solution, on a yearly bases that buys quite many programmer days of optimization.

    2. Re:There's only one solution... by Anonymous Coward · · Score: 0

      The problem isn't so much that it takes time to run stuff.
      The problem is that the fans runs louder that they should.

      Also, it feels a bit wrong to buy a gold machine just to run turd on it.

    3. Re:There's only one solution... by goose-incarnated · · Score: 1

      If performance sucks, buy a faster computer. Speed covers a multitude of sins.

      You're not a programmer, right? See things aren't so simple. A poor design decision will still be slow on a faster computer, and the speedup you get will not correlate to the extra money spent. Spending double on a new computer will not cause your program to finish in half the time if it's waiting on a poorly constructed network request.

      --
      I'm a minority race. Save your vitriol for white people.
    4. Re:There's only one solution... by __aaclcg7560 · · Score: 1

      You're not a programmer, right?

      Not professionally. I work in IT Support.

      Spending double on a new computer will not cause your program to finish in half the time if it's waiting on a poorly constructed network request.

      Those days are long over. I switched out my quad-core processor for an eight-core processor. Performance overall didn't improved that much because most of my applications are single core.

    5. Re:There's only one solution... by Anonymous Coward · · Score: 0

      Nah, install a real operating system instead of the one system from Mordor.

    6. Re:There's only one solution... by Anonymous Coward · · Score: 0

      When a developer managed to turn what should've been a O(n^2) operation into O(n^5) thanks to a poor selection of algorithm and data structures, that's not much of an option.

      By my estimates, the original implementation would've taken somewhere north of 100000 years to finish one run over a production dataset.

      And yes, the test data had a similar # of items, so that problem would've been caught much earlier if anyone had actually bothered to test against the entire set.

      So why were there no tests against the full dataset? Because that made the CI runs take too long.

      I ... wish I was kidding.

    7. Re:There's only one solution... by __aaclcg7560 · · Score: 1

      So why were there no tests against the full dataset? Because that made the CI runs take too long.

      As a software tester, I've done a few back of the envelope calculations, filed a bug report if the maximum value is too long, and forced the programmers to prove me wrong. Most of the time they go back and refactor the code. Sometimes they wait until the bug bites them in the ass just before code release.

  6. Evil bugs by Anonymous Coward · · Score: 1

    A performance bug is when the code computes the correct result,

    So... not bugs at all, then, really.

    Inefficiency is frequently a better option than nothing at all, and all code suffers from bit-rot.

    1. Re: Evil bugs by Zero__Kelvin · · Score: 2

      Yes. This is about opportunities for optimization, not bugs. All experienced developers know that premature optimization is evil. You write code to be easy to understand and maintainable first, then do a performance analysis and decide what is and is not "good enough". If you can't show that there is a true issue then you better be able to change it in a way that doesn't sacrifice readability, maintainability, reusability, etc. or you are a hack.

      --
      Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
    2. Re:Evil bugs by ThePyro · · Score: 1

      So... not bugs at all, then, really.

      Depends. It's a bug if the code is doing something different than what it's supposed to be doing.

      If your sort algorithm is supposed to run in O(N log N) but it actually runs in O(N^2) then I'd call that a bug. Algorithmic complexity can be a requirement just as important as the output. After all, the output hardly matters if your users die of old age before the algorithm finishes.

      If your code is performing unnecessary work then that might be a bug, depending on the author's intent. I've found errors in my own code which did not affect the results but resulted in inefficiency; stuff I hadn't intended to do, but by a stroke of blind luck just happened to produce the correct output in a different (read: slower) way.

      It's not a bug when the code is simply not optimal. Performance is not the only consideration: there's development time, ease of maintenance, readability, etc..

    3. Re: Evil bugs by Anonymous Coward · · Score: 0

      std::map is out in production. It isn't premature optimizations.

      Or perhaps C++ isn't ready to be used yet.

    4. Re: Evil bugs by Zero__Kelvin · · Score: 1

      Or perhaps you just came up with your own definition of premature optimization rather than using Knuth's as you should.

      --
      Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
    5. Re: Evil bugs by lgw · · Score: 2

      Fundamental library code is either as fast as possible, or useless. You know know who or how the library code will be used, so you have to assume plentiful use cases where every instruction matters. The std::map code is particularly bad (even in CLANG) .

      When you're delivering the end product, sure, don't optimize until proven necessary. That's a different world than library code. Not every thing is your thing, surprising as that may be.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    6. Re: Evil bugs by K.+S.+Kyosuke · · Score: 1

      rather than using Knuth's as you should

      Given the context of Knuth's quote, I'd be very wary of overreading it.

      --
      Ezekiel 23:20
    7. Re: Evil bugs by Anonymous Coward · · Score: 0

      Fundamental library code is either as fast as possible, or useless.

      When I use a library to do something useful, and the client finds it useful, and pays me for its usefulness, it is useful.

      "Not good enough for a real programmer like me" is turtles all the way down.

  7. Three things by Anonymous Coward · · Score: 0

    Understand how CPU works, code in C, don't use shitty 3rd party libraries.

    1. Re: Three things by Anonymous Coward · · Score: 0

      You forgot a point: never finish a project on time or make a client happy because you constantly reinvent the wheel.

    2. Re: Three things by Anonymous Coward · · Score: 0

      This is bullshit, and I'm talking out of experience, not out of horse's ass.

    3. Re: Three things by HornWumpus · · Score: 2

      You can optimize for dev time or CPU time. Which is cheaper?

      The inexcusable is optimizing for neither. e.g. server side javascript.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    4. Re: Three things by Anonymous Coward · · Score: 0

      When we're talking about performance, that is when making the user wait a bit is not an option. In other situations you have to find the right balance, but it's worth to think twice if ducktaping things together might cost you more than writing something from scratch. And there is a big difference between common beliefs and things that work best for you. I'm not talking about low-level optimizations anymore, as these hardly matter nowadays.

      As for javascript, I don't really want it near me.

    5. Re: Three things by HornWumpus · · Score: 1

      Two types of performance. If you don't get 'time to market' nobody will ever see the delay to complain about it.

      Which isn't an excuse for just plain bad programming. Which is a constellation of potential mistakes.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
  8. Shhh...don't tell him about scripting languages... by xxxJonBoyxxx · · Score: 5, Insightful

    >> that the user may never know they are there

    They will if they try to run a lot of them on a machine with finite resources, like a phone. Or it's a process that's iterated frequently, like a "big data" operation. But if the end user STILL doesn't notice it...then it's hard to call it a bug.

    On the other hand, the performance/just-get-er-done trade-off is well known to programmers of all stripes. (At least I hope it is - are people really finding new value in the article?) There's the quick and dirty way (e.g., a script), and then there's the "I can at least debug it" way (e.g., a program developed in an IDE), and then there's the optimized way, where you're actually seeing if key sections of code (again, especially the iterated loops), are going as fast as possible. Generally your time/cost goes up as your optimization increases, which becomes part of the overall business decision: should I invest for maximum speed, maximum functionality, maximum quality, etc.

  9. smells like advertising by Anonymous Coward · · Score: 0

    This story smells like advertising for some guy's template library.

    In a project I'm working on, I was sorely tempted to switch from STL to Boost. Trouble is, I didn't want to add another dependency to the project, when the STL was adequate. And container performance doesn't matter much when the network is the bottleneck.

  10. Is It A Problem? by Greyfox · · Score: 1

    Is it a problem, if no one notices? Most code can be optimized more than it is, but if everyone's happy with how it works, what's the problem?

    --

    I'm trying to teach myself to set people on fire with my mind... Is it hot in here?

    1. Re:Is It A Problem? by Anonymous Coward · · Score: 0

      Is it a problem, if no one notices? Most code can be optimized more than it is, but if everyone's happy with how it works, what's the problem?

      when you are maimed in your self-driving car because its computer was too slow to pick the crazy driver out of the crowd

    2. Re:Is It A Problem? by Anonymous Coward · · Score: 0

      That doesn't meet the "no one notices" criteria.

    3. Re:Is It A Problem? by __aaclcg7560 · · Score: 1

      when you are maimed in your self-driving car because its computer was too slow to pick the crazy driver out of the crowd

      You can't blame the self-driving car for an accident if the crazy driver drives out of a crowd into traffic. Cars in other lanes are predictable events. Cars driving on the sidewalk and running over pedestrians are not predictable events.

    4. Re:Is It A Problem? by Anonymous Coward · · Score: 0

      You certainly can if the car could have avoided him by being written a little better. It isn't much consolation who is at fault when you are injured though.

    5. Re:Is It A Problem? by Anonymous Coward · · Score: 0

      You can't blame the self-driving car for an accident if the crazy driver drives out of a crowd into traffic.

      why not? normal drivers are found at fault ALL THE TIME for NOT avoiding hazards

    6. Re:Is It A Problem? by __aaclcg7560 · · Score: 1

      why not? normal drivers are found at fault ALL THE TIME for NOT avoiding hazards

      Some accidents are unavoidable accidents that can't be prevented.

    7. Re:Is It A Problem? by __aaclcg7560 · · Score: 1

      You certainly can if the car could have avoided him by being written a little better.

      If the accident is avoidable. Some accidents are not. I read an article last year that self-driving cars won't be safe until all the human drivers are off the road.

    8. Re:Is It A Problem? by Anonymous Coward · · Score: 0

      why not? normal drivers are found at fault ALL THE TIME for NOT avoiding hazards

      Some accidents are unavoidable accidents that can't be prevented.

      and some are not!

      my GOD you are so smart!

    9. Re:Is It A Problem? by Anonymous Coward · · Score: 0

      I've never met anyone who doesn't think that his computer runs sluggish at some point or another.
      So people aren't happy. It's just that since no-one knows who to blame the frustration isn't directed at the programmer who caused to problem.

    10. Re:Is It A Problem? by __aaclcg7560 · · Score: 1

      my GOD you are so smart!

      Uh, no. Let's quote Blazing Saddles instead: "Ooh, baby, you are so talented! And they are so dumb!"

    11. Re:Is It A Problem? by jiriw · · Score: 1

      When such bugs are part of 'core' library code that's called often enough in a myriad of applications, it could affect performance and usability of your system when you do need the processing power for other things.
      Take this simple piece of code loosely based on something I wrote while in a long code session 10 days ago and found out, last week. Can you spot the bug? A hint: It decreases performance on average by a factor of 2 in certain conditions, it's very basic and the function definitely does what it says on the tin.


      func (b barn) NeedleInHaystackAndDoMore(theNeedle needle) {
              found := false
              for _,aNeedle := range b.haystack {
                      if aNeedle == theNeedle {
                              found = true
                      }
              }
              if !found {
                      b.haystack = append(b.haystack, theNeedle)
              }
              DoMore()
      }

    12. Re:Is It A Problem? by Anonymous Coward · · Score: 0

      I'm not familiar with the language, but by any chance does it have to traverse the entire haystack again on the append() call?

    13. Re: Is It A Problem? by Anonymous Coward · · Score: 0

      It doesn't abort the for loop as soon as a match is found.
      But if you're sequentially searching through enough rows to cause a problem you really should be using a different data structure.

    14. Re: Is It A Problem? by jiriw · · Score: 1

      That's correct, and correct in case of large haystacks. I did a simple sequential search because the haystacks were not that large (and not needle-sorted). But in the actual case, the barn consists of many haystacks ;) and the performance-bug did add up.

  11. "A little bit" by Anonymous Coward · · Score: 1

    Like windows update doing something in N*N instead of N?

    Yeah it's a little bit slower... At the beginning.

    Programmers need to always keep in mind that their software is always going to be used, by some people, for a longer duration than intended, and with larger datasets than expected.

  12. I used to be a God in optimization by Anonymous Coward · · Score: 1

    of C, C++ ("embedded C++"), assembly on Intel (with MMX/SSE/SSE2/...) and some VLIW architecture on TI C64x.
    But I am now managing projects.
    Because nobody gives a shit about performance, except for very specific niches (here audio video codecs).

  13. std::insert is double awful by gnasher719 · · Score: 1

    The first example: std::insert should do nothing if an item is already present. So calling std::insert only if the object is not yet present is 100% equivalent to calling std::insert directly, but it is 7 times slower.

    This violates the important principle that when using a library, the obvious way to do things should be the fasted. So hacks are required to make your code fast, and that shouldn't happen.

    I assume the explanation is probably that std::find is small enough to be inlined, while std::insert is too big, so nothing is inlined at all when you call it.

    1. Re:std::insert is double awful by pruss · · Score: 1

      Actually, the explanation in the article is that there is a memory allocation for a node done *before* checking whether the object is present. So if the object is present, there is a pointless memory allocation and deallocation done. Nothing to do with inlining, and an easy fix for the library: just swap the order of the check for presence and the memory allocation.

    2. Re:std::insert is double awful by Anonymous Coward · · Score: 0

      And it's things like this and unreadable 15-level deep compiler errors that made me just roll my own of whatever I need. Something simple as std::unique_ptr (trivial to implement) is impossible to debug as the pointer it holds has been converted to a variable-sized byte array. Good luck casting that to the proper pointer type in gdb.

  14. All code... by Anonymous Coward · · Score: 0

    All code can be optimized by 1 instruction
    All code contains at least 1 bug.

    Therefore, any program can be reduced to a single instruction, but it will be wrong.

  15. "x% slower than it should be" ? by Anonymous Coward · · Score: 0

    On what basis does the author assert things like "x% slower than it should be"? If the code meets the requirements, including all performance requirements, then there is no bug. Once the requirements are met, any further efforts to be x % better is waste. Development efforts should have moved on to the next project.

    1. Re:"x% slower than it should be" ? by ChrisMaple · · Score: 1

      Assuming that there aren't other disadvantages, if there's a faster algorithm or faster implementation that achieves the same goal, the slower approach is slower than it should be. For instance, using bubble sort when you could use quicksort.

      Just barely meeting your requirements leaves you vulnerable to a competitor who can do a better job.

      --
      Contribute to civilization: ari.aynrand.org/donate
    2. Re:"x% slower than it should be" ? by Anonymous Coward · · Score: 0

      Spending time optimizing your product for unnecessary reasons leaves you open to competitors that ship while you are having fun tweaking the already working code.

  16. Losing Battle by ghoul · · Score: 5, Insightful

    It is a losing battle to try and solve performance in the programmer space. The Compiler does a much better job of optimization due to a multitude of compiler trics including both Static and dynamic analysis, cache analysis and so on. The programmer trying to write the most efficient code should rather spend his/her time trying to use out of the box algos as far as possible as the compiler knows how to fine tune those. next they should run a profiling tool like jprofiler and see where the job is actually spending its time rather than trying to say this is probably the heaviest part of the program. With multiple cores and multiple instruction pipelines and optimizing compilers the bottleneck is oftentimes not where we would think it to be. Once we find the bottleneck using a profiling tool than we can optimize it. In most cases 2% of the code is causing 98% of the bottleneck so its a much better use of programmer time (which is of course more expensive than computer time in most cases) to work backwards.
    1 Write your code so that its correct irrespective of efficiency,
    2 profile and then
    3 fix the bottlenecks
    rather than trying to find the most efficient algorithms before you write your code.

    --
    **Life is too short to be serious**
    1. Re:Losing Battle by guruevi · · Score: 1

      The article is talking about Visual Studio, possibly the worst compiler in the world. There isn't much optimization going on there.

      --
      Custom electronics and digital signage for your business: www.evcircuits.com
    2. Re:Losing Battle by ghoul · · Score: 3, Informative

      Studio is an IDE. You can swap out the Microsoft compiler if you dont like it.

      --
      **Life is too short to be serious**
    3. Re: Losing Battle by Anonymous Coward · · Score: 0

      This comes down to old basic rules: premature optimization, assumptions about how a piece of code will perform on hardware. It seems that everyone has to find out for themselves. Or just write crappy software, which many seem to get away with nowadays.

    4. Re:Losing Battle by Anonymous Coward · · Score: 0
    5. Re:Losing Battle by Anonymous Coward · · Score: 0

      No, its programmers being lazy at everyone else's expense - CPU and memory vendors, network bandwidth, and the whole stack of people and costs that make the hardware end it all work.

    6. Re:Losing Battle by Anonymous Coward · · Score: 0

      The compiler can't optimize memory access patterns. Right now, bad memory access patterns are the driver of most performance issues.

    7. Re:Losing Battle by phantomfive · · Score: 1

      A lot of your post is good, including the advice to profile before optimizing, and looking for bottlenecks. However, people who think that compilers produce excellently optimized assembly are invariably people who've never looked at the assembly output of a compiler.

      It is in fact quite easy to produce better assembly than a compiler, although certainly time-consuming.

      --
      "First they came for the slanderers and i said nothing."
    8. Re:Losing Battle by Anonymous Coward · · Score: 0

      Yes, everyone actually looking at compiler output should know that a significant amount of code generated by the compiler is in fact earth-shattering stupid.
      Try for example creating a class with a mixture of data types and some padding, but make sure it's exactly 128 bit large.
      Then copy it around and weep as you see the compiler copy the bools and chars in it byte by byte (up to 32 instructions) when it could use max 2 SSE instructions instead (tested: gcc, llvm). It's a very common, trivial case and the compiler is a factor 16x off from the trivial optimal code.
      (yes, due to store-load aliasing and forwarding there MIGHT be cases where it might make sense to do it the slow way. When it's done with no read of this class anywhere nearby or enough writes around it to be sure it will have been thrown out of any buffers anyway it definitely does not though)

    9. Re:Losing Battle by Anonymous Coward · · Score: 0

      That's just not true. Take for example, sorting. There are several *completely different* algorithms which you can use for sorting. In no way should the compiler decide to convert you from having written bubble sort into performing quicksort. That's silly.

      Sorting is the "simple" well known problem that we already great solutions for. But many problems have efficient algorithms and inefficient algorithms.

      The same is true of data structures. If I am using a list for a certain problem, it will be slow for some operations. Maybe I should have coded it using a hash instead. Or a tree. The compiler will not automatically fix this for me. Additionally profiling and fixing bottlenecks probably won't either because I fundamentally started with the wrong data structure.

      It's worth knowing and thinking about the problems so that you can determine what the most useful data structure and algorithm for a problem is.

    10. Re:Losing Battle by Anonymous Coward · · Score: 0

      Just watch this https://www.youtube.com/watch?v=rX0ItVEVjHc

    11. Re:Losing Battle by guruevi · · Score: 1

      You're comparing two 20 year old proprietary compilers, one that went out of business before that post was even made. How hard did you have to dig for that one?

      --
      Custom electronics and digital signage for your business: www.evcircuits.com
    12. Re:Losing Battle by Cassini2 · · Score: 1

      Using SSE on an Intel processor is not always "the fast" an optimization due to the "special cases." For example:
      - Does the processor have SSE?
      - Is the target class guaranteed to fit inside one-page? If you can't guarantee the n-byte class fits cleanly inside a page boundary, then doing a 2^n byte copy could cause a page fault.
      - What is the page length anyways? It varies - more special cases.
      - What does the C/C++-standard say? Have you considered unions of structs with class wrappers? Just because any "good" programmer wouldn't do it, does not mean that these code sequences aren't used in production. MFC wraps the Windows API in an interesting ways.
      - Is the operation likely to be bandwidth limited? Essentially, the main memory is bandwidth limited on a modern Intel processor. As such, when doing copies, the code with the smallest number of main-memory accesses wins. Which piece of code is fastest can be really non-obvious when caching effects and misaligned accesses are considered.
      - The "string" MOV assembly instructions are so frequently used in Intel assembly, that the processor is heavily optimized to do them. This gives SSE such a minimal advantage that you need to know that the code your are writing is the special case where the SSE optimization is valid.
      - Compiler/programmer debug time factor. Is this optimization so incredibly specific that it depends on classes of exactly the correct sizes? Overly specific optimizations can cause numerous problems. For instance, the optimization may be wrong. The optimization may be correct, but it induces unsuspected bugs (say in code involving specific-sized unions, structs and classes.) The optimization may be indecipherable - other programmers may waste tremendous amounts of time on subtle compiled code changes.
      - Finally, is this optimization a better than other potential optimizations? There are lots of possible optimizations.

    13. Re:Losing Battle by Anonymous Coward · · Score: 0

      Wrong. No compiler is going to turn your bubble sort into a faster one. Complexity is still a thing.
      Compilers don't tune algorithms, they tune patterns (unroll loops, etc). The programmer is expected to know how those work, or some optimizations can't be made (for example, tail recursion).

    14. Re:Losing Battle by phantomfive · · Score: 1

      Have you looked at the compiler output from GCC (or llvm)?

      --
      "First they came for the slanderers and i said nothing."
    15. Re:Losing Battle by Anonymous Coward · · Score: 0

      You mistake your opinion as fact.

      Report back when you've compiled the same code on VS (MSBUILD) and any other and show me the huge difference in optimizations.

      Don't forget your chrome t-shirt and googley hat!

  17. Two Solutions by UnknownSoldier · · Score: 4, Insightful

    Programmers love to use the cop-out

    "Premature Optimization is the root of evil"

    dogma which is complete bullshit. It tells me your mindset is:

    "Oh, we'll "fix" performance issue later."

    Except later never comes. /Oblg. Murphy's Computer Law:

    * There is never time to do it right, but there is always time to do it over.

    As Fred Brooks said in Mythical Man-Month.

    "Show me your flowcharts and conceal your tables, and I shall continue to be mystified.
      Show me your tables, and I won't usually need your flowcharts; they'll be obvious."
    -- Fred Brooks

    Which can be translated into the modern vernacular as:

    * Show me your code and I'll wonder what your data structures are,
    * Show me your data and I'll already know what your code is

    There are 2 solutions to this problem of crappy library code.

    1. You are benchmarking your code, ALONG THE WAY, right?

    Most projects "tack-on" optimization when the project is almost completed. This is completely BACKWARDS. How do you know which functions are the performance hogs when you have thousands to inspect?

    It is FAR simpler to be constantly monitoring performance from day one. Every time new functionality is added, you measure. "Oh look, our startup time went from 5 second to 50 seconds -- what the hell was just added?"

    NOT: "Oh, we're about to ship in a month, and our startup time is 50 seconds. Where do we even begin in tracking down thousands of calls and data structures?"

    I come from a real-time graphics background -- aka games. Every new project our skeleton code runs at 120 frames per second. Then as you slowly add functionality you can tell _instantly_ when the framerate is going down. Oh look, Bob's latest commit is having some negative performance side effects. Let's make sure that code is well designed, and clean BEFORE it becomes a problem down the road and everyone forgets about it.

    2. You have a _baseline_ to compare against? Let's pretend you come up with a hashing algorithm, and you want to know how fast it is. The *proper* way is to

    * First benchmark how fast you can slurp data from a disk, say 10 GB of data. You will never be FASTER then this! 100% IO bound, 0% CPU bound.
    * Then, add a single-threaded benchmark where you just sum bytes.
    * Maybe, you add a multi-threaded version
    * Then you measure _your_ spiffy new function.

    Library Vendors, such as Dinkumware who provide the CRTL (C-Run Time Library), _should_ be catching these shitty performance bugs, but sadly they don't. The only solution is to be proactive.

    The zeroth rule in programming is:

    * Don't Assume, Profile!

    Which is analogous to what carpenters say:

    * Measure Twice, Cut Once.

    But almost no one wants to MAKE the time to do it right the first time. You can either pay now, or pay later. Fix the potential problems NOW before they become HUGE problems later.

    And we end up in situations like this story.

    1. Re:Two Solutions by Anonymous Coward · · Score: 2

      All well and good in theory, but have fun being beaten to market by your competitor who made it work to the customer's satisfaction faster because they didn't do in-depth performance testing every step of the way and just made sure it wouldn't be noticeably slow overall.

      I'm all for performance optimization while developing solutions so long as you aren't adding steps to delivering a solution that have no business value. If a widget has to function fast, by all means, test the crap out of it early and often. On the other hand, if there's a screen in your application that nobody would care if it waited for 5 seconds after users click a final submit button, why are you spending time cutting it from 2 seconds to 1?

    2. Re:Two Solutions by Anonymous Coward · · Score: 0

      Ah yes, "the Bethesda way".

    3. Re:Two Solutions by Anonymous Coward · · Score: 0

      All well and good in theory, but have fun being beaten to market by your competitor

      please provide an example of this happening

    4. Re:Two Solutions by 140Mandak262Jamuna · · Score: 1

      Please develop something non trivial that has to meet marketing and shipping deadlines, defects reported in past releases and then come back and read your own post to see how much of what you preach you have actually practiced.

      --
      sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
    5. Re:Two Solutions by Kielistic · · Score: 1

      Myself and millions of others love their games so it seems like an effective strategy.

    6. Re:Two Solutions by Anonymous Coward · · Score: 0

      Every single minecraft clone.

    7. Re:Two Solutions by Anonymous Coward · · Score: 0

      Been a long time (decades) since school and maybe this has changed since the "free market" seems to be over with the handful of giants in the room but ...

      Undergrad software engineering class. Professor brought in studies of software products ...

      All other factors being equal, first to market becomes the benchmark and makes money. Second to market might break or a little better if it is a superior product, everyone else loses money.

      With incremental delivery and software as a service etc. you can get lock in so maybe these rules are now a little fuzzy but every project I have worked on assumes the axiom.

      Our products are never "done" by market and really the customer purchases a 5 or 10 or 20 year service contract so ymmv but if we find a performance problem later on we just roll out a fix ... we are in the middle of this right now ...and it happens a lot less often than you think. Less than an average of one patch a year over last 10 years. The software is very significant and has 10s of obvious performance design issues (and how many less obvious ones?) that will only ever be fixed if someone hits a wall.

    8. Re:Two Solutions by Anonymous Coward · · Score: 0

      that has to meet marketing and shipping deadlines

      marketing deadlines trump bugs? jump now before it sinks

    9. Re:Two Solutions by Dixie_Flatline · · Score: 2

      "Premature optimisation is the root of all evil"

      is an aphorism that is exactly trying to get across what you say at the end

      "Don't assume, Profile!"

      Basically, the guy that originally said it was trying to say you can't guess what the problems are going to be before you lay the code down. Write the code correctly, but don't try to tinker with your scheduling algorithm to make it provably optimal when it's going to be dwarfed by order-of-magnitude problems with the network code.

    10. Re:Two Solutions by HornWumpus · · Score: 3, Insightful

      You are arguing against the misquote: 'Early optimization is the root of all evil'.

      Not the accurate quote: "Premature optimization is the root of all evil'.

      If you know a block of code is low, tight and potentially slow, it is not premature to write it with efficiency in mind from day one.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    11. Re:Two Solutions by HornWumpus · · Score: 1

      You only ship bug free code? Someone is lying, to yourself perhaps.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    12. Re:Two Solutions by 140Mandak262Jamuna · · Score: 1
      We are talking performance here. Not bugs. The code is correct and the solution is correct. It is just not as efficient as it could be.

      Further the inefficiency is in the STL implementation.

      Marketing and shipping dead lines are always important. We ship real software to real users who pay real dollars. 50K per seat per year. We raised 12 million in our IPO back in 1996. We are 9 billion market cap today. I stayed all the way through. The architecture I designed and implemented back in 1996 is scaling up to our current usage pretty damn good. We are not sinking anytime soon. I am quite proud of taking care of a critical component of our product for 20 years. yes, I pay attention to marketing and deadlines.

      --
      sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
    13. Re:Two Solutions by Anonymous Coward · · Score: 0

      Found the poseur.

    14. Re: Two Solutions by Zero__Kelvin · · Score: 3, Informative

      You don't seem to understand what Knuth meant by premature optimization. He specifically refers to optimizing prior to profiling. You claim it is bullshit and then go on to argue for its veracity by saying profiling first is correct just as Knuth was saying.

      --
      Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
    15. Re:Two Solutions by angel'o'sphere · · Score: 1

      I worked in plenty of organizations that only shipped bug free software.

      I personally had only one single bug (created by myself) delivered into production the last 30 years.

      However the last years I often worked in organizations that unfortunately accepted bugs going into production ... probably a reason why I don't work for them anymore ... it is just to annoying to have a stupid non working process and can not use the tools you want etc.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    16. Re:Two Solutions by angel'o'sphere · · Score: 1

      Unless you know it is only called once after the software is deployed.

      Or you know you have to ship in a few days, and writing it "perfect" takes longer than those days left.

      Should I continue? I probably find 200 reasons why "premature optimization" is as unpleasant as other "premature ..." things.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    17. Re:Two Solutions by Anonymous Coward · · Score: 0

      God, you sound like the sh*ttiest programmer in the world.

    18. Re:Two Solutions by Anonymous Coward · · Score: 0

      None of this applies to video games. If you release a badly-performing game, reviewers will be merciless and nobody will buy your game. Your competitor, who took his time and actually made a shippable project, will get good reviews and everyone will buy his game.

    19. Re:Two Solutions by HornWumpus · · Score: 1

      It's a stretch to claim you only ship code with no known bugs. To claim you ship bug free code is just silly.

      Non 'show stoppers' are documented and worked around, every day.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    20. Re:Two Solutions by HornWumpus · · Score: 1

      If you know that, it's 'premature' to optimize it. Unless of course the 'one time run' will take weeks, better test it against real world datasets. I've seen DBAs lock up systems with update scripts that would have run for _years_ (for apparently simple schema updates).

      Not all early optimization is premature. Redefining 'premature' as you just did, doesn't change the basic truth.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    21. Re:Two Solutions by angel'o'sphere · · Score: 1

      There never was a defect/bug report in my carrier blaming the defect on me, except the one I mentioned (that is _production code_).
      And as I said before: most of the time I worked the last 30 years in teams that had ZERO bugs in production. The issue trackers etc. prove that.

      The severity "showstopper" or "minor" has absolutely nothing to do with that.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    22. Re:Two Solutions by angel'o'sphere · · Score: 1

      You are redefining "premature" to early.

      We all are talking about "premature", you are not ;D

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    23. Re:Two Solutions by HornWumpus · · Score: 1

      Reread the thread.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    24. Re:Two Solutions by Anonymous Coward · · Score: 0

      Then why are EA and Ubisoft still in business?

    25. Re:Two Solutions by Anonymous Coward · · Score: 0

      It is FAR simpler to be constantly monitoring performance from day one. Every time new functionality is added, you measure. "Oh look, our startup time went from 5 second to 50 seconds -- what the hell was just added?"

      Learned this the hard way when programming for video games.

      You're just telling the computer what to do - often times, you're telling it to do a lot of other things without realizing it.

    26. Re:Two Solutions by darkain · · Score: 1

      EA Sports... That's why... #NFLRosterUpdate2018

    27. Re:Two Solutions by Anonymous Coward · · Score: 0

      You can either pay now, or pay later. Fix the potential problems NOW before they become HUGE problems later.

      If you missed a performance optimization opportunity that someone better informed than you might have seen... how would you know?

      If your code has a poor performance in a section of the code, but no users ever notice... is it a bug?

      If a tree falls in the forest when no one is around... does it make a sound?

    28. Re:Two Solutions by Anonymous Coward · · Score: 0

      We are talking performance here. Not bugs. The code is correct and the solution is correct. It is just not as efficient as it could be.

      guess what, failing a performance requirement is a bug

    29. Re:Two Solutions by Anonymous Coward · · Score: 0

      I personally had only one single bug (created by myself) delivered into production the last 30 years.

      Yeah. I don't test my code either.

    30. Re:Two Solutions by Anonymous Coward · · Score: 0

      They're good at conning customers and have lots of money to throw at marketing? Not everyone has that.

    31. Re:Two Solutions by K.+S.+Kyosuke · · Score: 1

      it seems like an effective strategy

      Except, it's an RPG!

      --
      Ezekiel 23:20
    32. Re:Two Solutions by 140Mandak262Jamuna · · Score: 1

      It did not fail any performance requirement. We meet the specs.

      --
      sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
    33. Re:Two Solutions by 140Mandak262Jamuna · · Score: 1
      So what kind of software and usage did your code have?

      For comparison, we have 10,000 seats. Multiprocessor license. My code typically clocks 3 CPU months per year per user. The minimum config machine for our software is 16 processors, 64 GB memory, typical installation is 32 processor and 128 GB. Going with 5000 users average over 20 year span, I estimate my code has clocked around 300,000 x 30 x 86,400 cpu seconds. 860 billion cpu seconds almost. Which means our FE solver has clocked 4 trillion cpu seconds!

      As of today I have 1 high priority and 58 total known defects.

      --
      sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
    34. Re:Two Solutions by Anonymous Coward · · Score: 0

      There is no free lunch. Time spend optimizing infrequently used code is better spent detecting and removing bugs. Correctness and maintainability are far, far more important than cpu cycles.

    35. Re:Two Solutions by Anonymous Coward · · Score: 0

      There is no known treatment for bad taste, unfortunately.

    36. Re:Two Solutions by angel'o'sphere · · Score: 1

      Never made such metrics.

      Usually I did back end software in Java (power companies, and internet companies). Before that I did very graphical software in C++ (CAD/geo information).

      My code made the power company I worked for not going bankrupt and made them sell a few 100 billions in electricity the last 10 years.

      However they never payed me properly for that ;D

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    37. Re:Two Solutions by Anonymous Coward · · Score: 0

      *than

    38. Re:Two Solutions by Anonymous Coward · · Score: 0

      This!
      The Real Experts know to consider performance from design to release.
      And, a few times between design and release someone needs to go in and just review the code to see if more optimizations can be made.

      One reason no one does this is that high-perfoming code in many languages looks different than code which meets coding guidelines or Looks Good to the design bigots.

      Since the children don't understand Computer Science, they don't realize that the crap they copy from stackoverflow may not be the best way to get the job done.

    39. Re:Two Solutions by next_ghost · · Score: 1

      NOT: "Oh, we're about to ship in a month, and our startup time is 50 seconds. Where do we even begin in tracking down thousands of calls and data structures?"

      Oprofile can annotate the entire source code with execution time statistics, line by line. I don't understand how developers on Windows can live without it.

    40. Re:Two Solutions by Anonymous Coward · · Score: 0

      You seem to have very specific domain knowledge but somehow do not understand that not all software is built like yours, and also misunderstand what premature optimization is. Premature optimization is losing code legibility to gain some unspecified performance with "tricks" just because we can, before it's even shown that the section is actually a performance bottleneck. For example, optimizing some directory-file lookup in a tool that spends most of its time processing the data in the file.

    41. Re:Two Solutions by Anonymous Coward · · Score: 0

      You assume the customer is going to wait and pay for all the extra time involved.

      In my 30 years of coding I can say for sure - that's a big fat nope.

      I've watched companies design these clever 'patterns' and call them all kinds of neat names in the name of optimization. A 20% gain on a process that runs in MILLISECONDS..

      You younger folks love making mountains out of mole hills.

  18. Isn't there a saying by Anonymous Coward · · Score: 0

    Along the lines of preoptimization is the root of all evil. Because if the user doesn't notice the .01ms of lag caused by a performance issue why the hell would I want to pay a software engineer 1hr of time to fix it.

  19. Scale it... by mi · · Score: 1

    Who really cares if I can get a loop to run in 800ns instead of 1500ns

    Indeed. A human being can not even perceive a difference between 1 millisecond and 1 microsecond.

    But, repeated a million times, the former turns into 15 minutes, whereas the latter is still merely a second. Food for thought...

    --
    In Soviet Washington the swamp drains you.
    1. Re:Scale it... by ChrisMaple · · Score: 1

      Any human not deaf can hear an audio sine wave with a period of one millisecond. The same is not true of a sine wave with a period of one microsecond.

      --
      Contribute to civilization: ari.aynrand.org/donate
    2. Re:Scale it... by parkinglot777 · · Score: 1

      Indeed. A human being can not even perceive a difference between 1 millisecond and 1 microsecond.

      But, repeated a million times, the former turns into 15 minutes, whereas the latter is still merely a second. Food for thought...

      And you said as if most programs/applications nowadays required that many loops, or even a minute long to complete a run. Also often times, programs/applications are web base and/or deal with database stuff that always have a bottle neck issue else where as the GP already stated.

      Anyway in programming, I always prefer correctness over speed (and I believe all computer scientists prefer the same). You can always try to optimize a program as long as it runs correctly. If a program isn't running correctly, it is simply a garbage regardless how fast it can run.

    3. Re:Scale it... by mi · · Score: 1

      programs/applications are web base and/or deal with database stuff that always have a bottle neck issue else where as the GP already stated.

      The observation I posted is just as applicable to the SQL-queries and even the database-servers themselves.

      --
      In Soviet Washington the swamp drains you.
    4. Re:Scale it... by Anonymous Coward · · Score: 0

      Cute.

  20. Check the links by darkain · · Score: 1

    Check the links, decent code and analysis. Short and simple. I recently found a very similar bug in both PHP and HHVM with their trim() function (and variants there of). In both PHP and HHVM, trim() unconditionally allocates more memory, even if there is no white-space on either end of the string to trim. It is faster to write PHP code to check for white-space on both ends and then conditionally call trim() on a string.

    1. Re:Check the links by ElizabethGreene · · Score: 1

      I recently found a very similar bug in both PHP and HHVM with their trim() function

      When you have a moment, can you submit a bug over at bugs.php.net?

    2. Re:Check the links by Too+Much+Noise · · Score: 1

      Actually, it's not (only?) a library bug, but a(lso) programmer bug. Using std::make_pair(x, x) makes a pair, duh! Complaining about it is silly. Hint: the initializer list version of insert() is faster than the pair version (at least on sane platforms, Microsoft can be weird about c++)

    3. Re:Check the links by darkain · · Score: 1

      I'm still trying to find a small isolated test case, which is proving difficult. The script in question is a data importer dealing with ~100,000 rows and ~10 columns at a time, so 1mil entities being trimmed. In smaller cases, built in trim is faster, but once it breaks around 100k calls, it is faster to manually check if data could be trimmed before calling trim. At 1mil, it is an order of magnitude faster. But building a small test case doesn't yield these same results. When I figure out the right combination of things I'll be filing the report.

  21. Sounds like a creative way to say that... by DatbeDank · · Score: 1

    The programmer is writing crappy and unoptimized code.

  22. It's a myth... by ZecretZquirrel · · Score: 1

    It's a myth of the cult of unit-testing that all tests passed == no bugs. Correctness bugs outlive all executed tests, and are a worse form of dark matter because they give no outward signs.

    1. Re:It's a myth... by __aaclcg7560 · · Score: 1

      Depends on how well the unit test is written. I spend three times more time writing the unit test than the actual code. Mostly because I test for what the results should be and every possible edge case that I think could happen. Once I'm satisfied with the unit test, I'll tweak the code for speed.

    2. Re:It's a myth... by ZecretZquirrel · · Score: 2

      So it's highly dependent on what you think could happen, and what satisfies your sense of sufficiency. Of course, your time needs to be weighed against the cost of failure from the bug manifesting itself. Despite all that's been invested in development methodology, this is remains a black art.

    3. Re:It's a myth... by __aaclcg7560 · · Score: 1

      So it's highly dependent on what you think could happen, and what satisfies your sense of sufficiency.

      It's called programming. The [computer | self-driving car | AI | programmable girlfriend] is no better than the person who wrote the software.

      Despite all that's been invested in development methodology, this is remains a black art.

      That's why I always laugh when a computer science graduate gets on his high horse. Those of us in the trenches know better.

    4. Re:It's a myth... by Anonymous Coward · · Score: 0

      Yes. Of course, it is a black art. It is a black art because there will always be some important cases where understanding your requirements is hard for a skilled human and impossible for any known alternative to having a skilled human.

      And, of course, sometimes requirements change after the code is an apparent success in the field.

      Mind you, I do not doubt that better and better tools/compilers can catch certain common errors.

    5. Re:It's a myth... by Anonymous Coward · · Score: 0

      Does anyone really believe that tests passed means no bugs? I've never met anyone. Tests failing means that there is probably a bug relative to the specification, assuming the test is right. Of course the specification may be wrong. The specification may include performance, and probably should.

      In any case, unit testing is about enforcing contracts about the code, and contractually-based coding has a long heritage.

    6. Re:It's a myth... by Anonymous Coward · · Score: 0

      Don't laugh. A CS could prove that your well-tested program is actually broken. And a CS could show you that your well-tested program's performance won't scale in production.

    7. Re:It's a myth... by __aaclcg7560 · · Score: 1

      A CS could prove that your well-tested program is actually broken.

      When I first got a job as a video game tester, my supervisor gave me a notepad and let me play the video game that they released the year before. I found every bug that the game shipped with. Over the next six years, I would write 30,000+ bug reports and be responsible for ten titles as lead tester. I'm well familiar with well-tested code being broken because management overruled me at the code release meetings.

      And a CS could show you that your well-tested program's performance won't scale in production.

      A problem domain that doesn't keep me up at night because I'm just a coder and not a professional programmer.

    8. Re:It's a myth... by HornWumpus · · Score: 1

      A CS could also spend a year converting your data structure to the 75th normal form and make everything slower in the process.

      CS proves nothing, degrees prove nothing. Enough colleges suck to devalue the degrees to near zero. Some recent CS grads are worth hiring, but it's a clear minority.

      'Coding' Jr college degrees are the same.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
  23. A small constant factor is not a bug by Anonymous Coward · · Score: 1

    Come back when you want to talk unnecessary complexity increases, like the update procedure that takes exponential time.

  24. Story Time! by Thelasko · · Score: 1

    I interact with a piece of code I don't maintain that has this issue. A piece of Visual Basic (don't get me started) that copies from a source to a destination. However instead of using B=A to move the data, the author used copy(A) and paste(B). The data therefore interacts with the clipboard, slowing the process down.

    The issue might not be noticeable on a small amount of data. However, I use this piece of code to move gigabytes of data every day.

    --
    One of our competitors trademarked the term "hypothesis". From now on, we will call them "boneheaded ideas".
  25. As if to echo your point by Foofoobar · · Score: 0

    Showed this to Netflix once and they stated 'This fixes everything we are currently having issues with'. Apparently the entire industry has implemented API's in distributed architectures in such a way as to create architectural cross cutting concerns... https://www.slideshare.net/bob...

    --
    This is my sig. There are many like it but this one is mine.
    1. Re:As if to echo your point by xxxJonBoyxxx · · Score: 2

      Congratulations - you've invented the "message queue".

    2. Re:As if to echo your point by Foofoobar · · Score: 1

      Incorrect. Message queues dont share IO state either. You would know that if you tried to pass back to proxy or api server. They cannot synchronize state and the best people have figured out is to pass a 'state token'. This doesn't work however because IO's central version of truth is where I/O meets and so when proxy sends state token, api server may have different state because they didn't synchronize since last update to api server. Or perhaps MQ has different stae from api server and thus rejects because it didn't synchronize. Yeah so... nothing like MQ my friend. Try to understand I/O before commenting like a monkey behind a typewriter

      --
      This is my sig. There are many like it but this one is mine.
    3. Re:As if to echo your point by K.+S.+Kyosuke · · Score: 1

      I believe that Alan Kay may have invented it, actually.

      --
      Ezekiel 23:20
  26. Slower than it should be ... in VS2015 by Anonymous Coward · · Score: 0

    Surprise, surprise, surprise!

  27. CarbonBlack is a perfect example by whitroth · · Score: 1

    We were required to install it on our Linux servers - we run CentOS (same as RH). Every few days, the stupid monitor is suddenly eating 99%-100% of the CPUs... for *hours*. Overnight.

    I attached strace to it, and it's in some insanely tight loop, looking at its own threads.

    Maybe if I prove that it's doing it on multiple servers (it is, but I have to catch it - nothing's reporting this, unless it runs the system so hard it throws heat-based machine checks), and put a ticket in, and *maybe* the team that forced it on us will *maybe* talk to CarbonBlack....

    I have *zero* doubt that there's a ton of other COTS products with issues like this.

    1. Re:CarbonBlack is a perfect example by Anonymous Coward · · Score: 0

      I have a similar story.

      So, at work we have some sort of Dell "workstations" (not actually rated to do work). Before IT got everything in order, we were mostly using them straight out of the box. I took the time to delete all the pre-installed nonsense, but not everyone did.

      Consequence, one of my co-workers had an issue that if he left his system on overnight, it would have 90% CPU usage, 80% memory usage and 100% drive access continuously, without him starting any applications.
      After some analysis, we are pretty sure that the Dell cloud-backup-buzzword-something program was trying to archive changes to a remote server, but running into issues as it grew beyond the physical memory of the machine and started swapping part of its temporary list. Which wouldn't be crippling, except it appears to have been trying to analyze the swap file for changes, which changed every time a new bit of file log was swapped over to free up physical memory for the next record about the condition of the swap file.

  28. Lazy is the rule by nospam007 · · Score: 2

    Being an old fart, in my day, I remember the worst performance problems were caused by programmers with their own badly written library of functions and objects that they included everywhere, most of those were from their very first weeks of being a programmer and they sucked badly.

    1. Re:Lazy is the rule by __aaclcg7560 · · Score: 1

      The opposite extreme is where everyone linked their project to a left-pad package and the developer pulls the package in a hissy fit, breaking the Internet at the same time. A left-pad function is something that every programmer should be able to pull out of their ass.

      http://www.haneycodes.net/npm-left-pad-have-we-forgotten-how-to-program/

    2. Re:Lazy is the rule by Anonymous Coward · · Score: 0

      Here's an example: https://svn.boost.org/trac/boost/ticket/11458

      The bug is caused by a lazy dev using std::valarray because it has some nice functions (abs, max, etc), but it is designed for a variable sized number of elements. Since there are only ever 2 or 4 numbers needed, the malloc/new std::valarray performs (and the corresponding free delete) eats time that isn't needed. Maybe no one cares about it in their shitty little toy rotation project, but when you're trying to perform real-time aero simulations, it has a huge impact.

      TFW it's not fixed nearly two years after it was submitted.

    3. Re: Lazy is the rule by Zero__Kelvin · · Score: 1

      I don't know? Why haven't you fixed it?

      --
      Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
  29. Darker than Dark by John+Da'+Baddest · · Score: 1

    And if you think the performance N.F.R. is dark, wait 'til you find out about security.

    NFR

    1. Re:Darker than Dark by Anonymous Coward · · Score: 0

      There's overlap between security and functional requirements since memory corruption can cause crashes, buffer overflows and alignment errors can cause optimizations to fail, etc.

  30. Performance is for slow languages by Anonymous Coward · · Score: 0

    People use sloooow languages, like C or ASSembly which "compile" into a static binary, which is slow.

    Java uses Hotspot [garbage collecting ] so applications are always [GC] impro [GC] ving performance on the f [GC]l [GC] [GC][GC] [GC] y and go even faster.

    I don't [GC] [GC] [GC] bother with performance. need to sort? I use bubb[GC] [GC] [GC]le sort, because Java can make it [GC] [GC] [GC] [GC] so much faster than [GC] [GC] [GC] c's "quick" sort, and it saves me lots of [GC] [GC] [GC] [GC] [GC] typing.

    For more performance, Java applications should run on a java system, running a java bytecode interpreter running on java. More [GC] [GC] [GC] recur[GC][GC][GC]sion means more [GC] [GC] [GC] [GC] speed, and less mem[GC][GC][GC][GC][GC]ory.

    1. Re:Performance is for slow languages by Anonymous Coward · · Score: 0

      Call gc() manually between paragraphs, genius.

    2. Re:Performance is for slow languages by K.+S.+Kyosuke · · Score: 1

      Hilarious. But on modern machines and language runtimes, GC is for a substantial problem domain definitely better than many of the other options, especially the ones that require refcounting. Those that do not often involve manual decisions. Your problems are going to lie elsewhere.

      Where Java actually has a problem is the "everything is a headered object" approach. Now that is a lot of unnecessary waste.

      --
      Ezekiel 23:20
  31. A Very Old Performance Problem, Mostly Forgotten by middlebass · · Score: 3, Interesting

    In 1973 or 1974 I was the systems programming manager at the National Academy of Sciences after our IBM mainframe had been upgraded to the first version of the OS supporting virtual storage. And many programs, mostly Fortran programs, were running much slower than they used to. The problem was two-dimensional arrays and how they were initialized and searched. If you're looping through the wrong subscript in a big array, you cause a page fault every time you increment it. Flash storage makes that a much smaller problem than it is with disk drives, but I'm sure most programmers today have no idea that this problem exists or how to handle it.

  32. Re:A Very Old Performance Problem, Mostly Forgotte by Anonymous Coward · · Score: 0

    Only because Fortran stores multidimensional arrays in column-major order, while every other language in the known universe uses row-major order.

  33. Not bugs until they cause problems by Tony+Isaac · · Score: 1

    The rule of thumb for programming anything is, first make it work, then make it work better / faster.

    If the first pass works well enough and fast enough, it doesn't matter if the code was written an efficient manner. If somebody used bubble sort for an array of 5 items, who cares? If the array becomes larger, now you have a performance bug.

    It's literally wasteful to spend time on performance enhancement before you know which performance problems actually occur in real life. Another name for premature performance enhancement is "gold plating."

    1. Re:Not bugs until they cause problems by Anonymous Coward · · Score: 0

      First, you make it work.

      Then, you fix the segmentation faults.

      Eventually, hackers compromise your code through a buffer overflow which you missed because it wasn't triggering a segmentation fault.

      Inevitably, security researchers publicize your mistake and news sites give the flaw a memorable name and every story about the security flaw links to your blog.

      Finally, you kill yourself in shame.

    2. Re:Not bugs until they cause problems by swilver · · Score: 1

      In my experience, way too many programmers go for the obvious, short-cutting, direct, layer-breaking solution because it only requires writing a few lines of code. Out of an infinite set of possible solutions for the problem, they choose the one that saves them the most characters typed.

      Experienced ones however will reduce the solution space and reject solutions that don't adhere to architectural criteria right from the start, and write something that looks a little more complicated but in fact results in a far more elegant, better scaling and maintainable solution.

    3. Re:Not bugs until they cause problems by __aaclcg7560 · · Score: 2

      [...] looks a little more complicated [...]

      A different programmer looks at it a year later, determines that it looks too complicated, and refactors the code to be more simpler "in a far more elegant, better scaling and maintainable solution."

    4. Re:Not bugs until they cause problems by Anonymous Coward · · Score: 0

      A bug is a risk, so is already a problem, even if no one has yet experienced it. It may not be economical to fix it, though.

  34. coder vs programmer by l3v1 · · Score: 1

    "an experienced programmer, with a reasonably accurate mental model of the problem"

    Well, that's one of the many things that separate programmers from coders as I designate them. I.e., the ones who know and do vs. the ones who have a limited clue at most but do it nonetheless and behave like they'd be the gods of algorithm and program development. In my book, and in my area of work, a code that gives the result but it's 2-7-whatever times slower than it could be with some actual knowledge besides tapping codewords in the correct order, that code is nothing besides a limited applicability proof of concept at best, targeted for supporting viability and then destined for disposal. That's why I never worked with coders and I don't care for the gazillions out there who think the ability to use python makes them devs or software engineers, oh my. Also, for the poster, performance issues regarding stl, well, good story, no news.

    --
    I am putting myself to the fullest possible use, which is all I can think that any conscious entity can ever hope to do.
    1. Re:coder vs programmer by __aaclcg7560 · · Score: 1

      Seems like you're complaining about script kiddies and not coders. I'm a coder because I got my programming degree from a community college and I don't work professionally as a programmer (I work in IT support), but I can think through a coding problem well enough than most programmers I know.

    2. Re:coder vs programmer by Anonymous Coward · · Score: 0

      IT guy! My mail is crashing! It says assertion failed! Fix it with your coding skills! Quickly! IT guy stop surfing donkey porn and fix the code now! I need my mail!

    3. Re:coder vs programmer by __aaclcg7560 · · Score: 1

      IT guy! My mail is crashing! It says assertion failed! Fix it with your coding skills! Quickly! IT guy stop surfing donkey porn and fix the code now! I need my mail!

      Sorry. I work in InfoSec, not Help Desk. Call 1-800-IBM-HELP.

    4. Re:coder vs programmer by Anonymous Coward · · Score: 0

      I can think through a coding problem well enough than most programmers I know.

      And you can obviously grammar well enougher than most programmers, too!

      Funny how the guy claiming he's really great at thinking through things can't catch obvious errors in his own writing.

    5. Re:coder vs programmer by __aaclcg7560 · · Score: 1

      Funny how the guy claiming he's really great at thinking through things can't catch obvious errors in his own writing.

      Perfect grammar isn't a requirement for thinking through problems. My obvious error is the usage of "than" (comparison) rather "then" (time). A common mistake that I make because it's related to my learning disability of being unable to distinguish similar sounding words (i.e., than/then, glass/grass or ear/year) due to a hearing loss in one ear. Than/then was a particular challenge until a college instructor explained the differences.

    6. Re:coder vs programmer by Anonymous Coward · · Score: 0

      Better surfing donkey porn than cow dong porn and eat indian pussy....sorry, I am the network guy, go hang yourself by your dick.

    7. Re:coder vs programmer by ruir · · Score: 1

      You really must grow out of help desk and learn some useful stuff...imbecile fucker. And stop pretending you understand something about computers or even know how to read English errors. You are a fucking waste of space on this planet.

    8. Re:coder vs programmer by Anonymous Coward · · Score: 0

      You accidentally a few words.

      I can think through a coding problem well enough, as well as or better than most programmers I know.

    9. Re:coder vs programmer by __aaclcg7560 · · Score: 1

      You accidentally a few words.

      According to https://grammar.com/ my usage of "than" was called into question.

      I can think through a coding problem well enough, as well as or better than most programmers I know.

      According to https://readable.io/ your sentence has too many adverbs ("well" flagged twice). It also reads like an English major writing out of his ass.

    10. Re:coder vs programmer by __aaclcg7560 · · Score: 2

      You really must grow out of help desk and learn some useful stuff...imbecile fucker. And stop pretending you understand something about computers or even know how to read English errors. You are a fucking waste of space on this planet.

      That's kind of harsh to say to an AC. :P

    11. Re:coder vs programmer by Anonymous Coward · · Score: 0

      eat indian pussy

      Buzz back the shrubbery and it's all good. They do run a little on the furry side.

    12. Re:coder vs programmer by Anonymous Coward · · Score: 0

      Than is operator>= ()

      Maybe you want memcmp ()

      I can think through a coding problem well enough compared to most programmers I know.

    13. Re:coder vs programmer by __aaclcg7560 · · Score: 1
  35. Video stutter by Anonymous Coward · · Score: 0

    Well, if you think of video stutter on Windows or Linux with a bad Nvidia driver, then it really is dark matter.

  36. Re:A Very Old Performance Problem, Mostly Forgotte by swilver · · Score: 1

    So, I profile that code, I find, hm, odd, this loop is taking a lot of time.

    It's accessing some array, wierd, array accesses are normally blazingly fast.

    Oh look, it's a two dimensional array, that's something you don't see every day!

    Let's play a bit with the code, hey, it's fast now that I'm looping through it differently... hm, I wonder how that thing is laid out in memory... oh, could it be that it is causing cache line misses / page faults / disk cache misses (yes, those abstractions are present at every level)?

  37. 1st time: verbal warning, ... by Anonymous Coward · · Score: 0

    The first time you pulled this wastage you would get a verbal warning.
    Second time you pulled this, I'd try to fire you, but HR would want a written warning, so I'd give you a written warning.
    Third time you pulled this, I'd sent the second written warning to HR and they would have security frog march your time, money and attention wasting self out the door.

    Premature means premature. Learn the word, or leave. Feel free to discuss if its changed to mature, and life is good. Add your own requirements and delay shipping, GTFO.

    (CAPTCHA: Shouted)

  38. Re:They are the dark matter by Anonymous Coward · · Score: 0, Funny

    If muslims were made of dark matter then their matter bombs wouldn't interact with them and they wouldn't be suicide bombers. They would just be bombers.

  39. simple solution by TimMD909 · · Score: 4, Funny

    This is why I do all my coding in PHP and JavaScript. Performance concerns are jettisoned before the coding even starts.

    1. Re:simple solution by Tablizer · · Score: 1

      This is why I do all my coding in PHP and JavaScript. Performance concerns are jettisoned before the coding even starts.

      When you see "launchSpam();" clock out for the day.

  40. That's my speedup loop, you clod! by johanwanderer · · Score: 3, Funny

    For an explanation: http://thedailywtf.com/article...

  41. Hold the phone. by Gravis+Zero · · Score: 2

    Isn't this why we have profilers like Valgrind to identify slow functions?

    --
    Anons need not reply. Questions end with a question mark.
    1. Re:Hold the phone. by Anonymous Coward · · Score: 0

      Do not let facts and good practices get the way of good story. After all, it is slashdot...

  42. Recent Example by The+Raven · · Score: 1

    Often performance issues are caused by a sub-optimal algorithm. It works, but a different approach would be better. A recent dev post about the game Factorio highlighted a more straightforward issue:

    Finally the blueprint tooltip preview: this one stumped me for a while. I've known it was slow since I first started with Factorio 2+ years ago but could never pin-point exactly what was causing it. The drawing of the blueprint preview is near identical to what happens when you view the normal game but would always take 4-5 times as much time to render. Finally recently I found that we did zero batching of sprites to be drawn when rendering the GUI: for every sprite that we would draw it would go out to the graphics card and tell it to draw it. Fixing that was as simple as turning a flag on and now it has no measurable impact on performance when rendered.

    A one-parameter fix to a long-standing bug. Gotta love it.

    --
    "I will trust Google to 'do no evil' until the founders no longer run it." Hello Alphabet.
  43. Actually important. by hraftery · · Score: 1

    I came here looking for the usual discrediting due to edge cases, obscure platforms or bad statistics. Instead there's a bunch of arguing over the tired old "it does (not) matter", so I had to look myself. Well blow me down, this is as clear as day - on recent Visual Studio and XCode with clang, unsorted_map::insert is 7 times slower than calling unsorted_map::find first and skipping the call to insert if it already exists. That's just what insert is supposed to do for you. The platforms, the compilers, the library and the functions are all extremely common. Debugging suggests the delay is due to an unnecessary alloc/dealloc. Good find!

  44. Wow, just wow by Anonymous Coward · · Score: 0

    So many performance-insensitive clods commenting on Slashdot these days.

  45. Re:A Very Old Performance Problem, Mostly Forgotte by TeknoHog · · Score: 1

    Only because Fortran stores multidimensional arrays in column-major order, while every other language in the known universe uses row-major order.

    Julia is another that I know of, not surprisingly because it continues the scientific computing traditions of Fortran in many ways. From TFM:

    Multidimensional arrays in Julia are stored in column-major order ... This convention for ordering arrays is common in many languages like Fortran, Matlab, and R (to name a few). The alternative to column-major ordering is row-major ordering, which is the convention adopted by C and Python (numpy) among other languages.

    --
    Escher was the first MC and Giger invented the HR department.
  46. SQL code would be full of them by scdeimos · · Score: 1

    SQL Server's query planner gets better and better with every release, but it still screws up on a regular basis. To have efficient queries on SQL Server the programmer (in the absence of a full-time DBA) needs to know far more about the internals of the server than they really should. Some of the common issues for slowly running queries I see include:

    • Scalar UDFs (User-Defined Functions) are pure evil. Query Planner always estimates their cost at 0, no matter how complex their implementation. Scalar UDFs used in queries are run RBAR (Row By Agonizing Row) so their real world costs add up very, very quickly. If you absolutely must have Scalar UDFs in your system ensure that they perform no table accesses whatsoever and only operate on the provided parameters.
    • Closely related to Scalar UDFs, and for the same reason, Table Valued Functions can be evil as well. Prefer to use Inline Table Valued Functions (that do not contain BEGIN and END keywords) which behave more like Views. Query Planner can inline the code of ITVFs into the current statement and even optimize out whole chunks of code if it detects that they're unnecessary to complete the query.
    • Bad indexes. Indexes should be chosen based on cardinality so that the least number of B-Tree traversals are required to get to data, e.g.: prefer (InvoiceID, BusinessID) over (BusinessID, InvoiceID) as there'll be far more invoices than businesses in your system.
    • Out of date index statistics. Left to its own devices, SQL Server doesn't update indexes statistics anywhere near as frequently as it should. If you have an indexed table that's regularly having rows inserted and deleted (especially if you run a "soft deleting" system) you should consider updating statistics yourselves on a recurring schedule or after X rows have changed.
    • Every foreign key should be indexed, and, in the case of Composite Foreign Keys, the order of the FK items should match the column order and the asc/desc order of the referenced Primary Key indexes.
    • Also related to index statistics is something that bites new programmers all the time: Did you know that statistics for #Temp tables and ##Temp tables are cached between uses? i.e.: if you put indexes on #Temp and ##Temp tables in your queries you should immediately run update statistics...with fullscan on them before using the temp tables, otherwise Query Planner makes decisions based on what the same-named temp tables had last execution!
    • SQL Server's a mine field of bad performance for the unaware. I doubt it's much different in Oracle and MySQL/MariaDB.

  47. these hackers are the best by Anonymous Coward · · Score: 0

    From my experience, some hackers are polite and professional, but lack the skills, experience or technology to be worth it for me,I once hired a hacker and charged me $460 but could not locate the person who hacked my gmail account and sent out personal emails. I then hired ZeusHacks and they located the perpetrators within 6 hours at a cheaper price. You can contact them on ZEUSHACKERS01 at OUTLOOK dot COM . They offer lots of hacking services like social media hacks like facebook hacks, kik hacks, bank account hacks, iCloud hacks, whatsapp hacks, recover passwords, upgrading school grades

  48. Re:Shhh...don't tell him about scripting languages by K.+S.+Kyosuke · · Score: 2

    Although, a "scripting" language without a serious performance bug may actually process a larger data set faster than a program written even in a system language like C, if said latter program contained a serious performance bug. But not making obvious mistakes is hardly "optimization". At the risk of making a little bit too contrived example, the decision not to use a bubble sort is not something I'd call optimization. It's just common sense.

    --
    Ezekiel 23:20
  49. Re:A Very Old Performance Problem, Mostly Forgotte by K.+S.+Kyosuke · · Score: 1

    I'm pretty sure that you have effectively still the same problem with CPU caches and that this is the reason why Fortran compilers regularly perform loop transformations today.

    --
    Ezekiel 23:20
  50. Re: A Very Old Performance Problem, Mostly Forgott by middlebass · · Score: 1

    But the problem most likely exists in all the newer languages, yet I have never heard of programmers being aware of it or optimizing for it.

  51. Re: A Very Old Performance Problem, Mostly Forgot by functor0 · · Score: 1

    I might be biased because I work in the computer graphics industry but memory coherency is the first thing we think about when doing something new. This is also a major point if you look at any of the presentations about performance at CppCon (C++ conference). They are easily found on YouTube. See also data oriented programming. This is NOT a forget ten problem at all.

  52. Re: A Very Old Performance Problem, Mostly Forgott by Cassini2 · · Score: 1

    Every numerical methods text involving a scientific math library has warnings about the array-transposition bug. Huge math optimization work has gone into dealing with it. The problem is much worse in modern super-computers than in the older computers. In the old computers, memory accesses were fairly predictable. New supercomputers are clusters of computers. Each node can only hold a small section of a large array, and communication time is often a function of both the distance between nodes in hops and total communication load (saturated interconnects).

    Huge work goes into figuring out how to do array operations in a fast manner. The work often becomes highly application dependent. Find special short-cuts that apply to particular matrices that allow one to make use of special theorems.

  53. Re: A Very Old Performance Problem, Mostly Forgott by K.+S.+Kyosuke · · Score: 1

    Huge work goes into figuring out how to do array operations in a fast manner. The work often becomes highly application dependent. Find special short-cuts that apply to particular matrices that allow one to make use of special theorems.

    This is actually one of the things I'd like to see in the kind of experimental compiler I outlined above.

    --
    Ezekiel 23:20
  54. McAfee by Tablizer · · Score: 1

    or security admins who misuse McAfee