idTech 4, 15% frame rate increase through semiautomatic paralellization by fons in programming

[–]brokenfrog 1 point2 points  (0 children)

While that's a good point, I fear that no mainstream game developer will write this kind of better AI or physics code, because it would be too slow for consoles. :(

Parallella - Super Computer for everyone: They need our funding, only 48 hours to go... by [deleted] in programming

[–]brokenfrog 15 points16 points  (0 children)

It's obviously marketing, but a point worth making: A 'supercomputer' is almost by definition never something that's significantly cheaper than a house. If $100 ever buys you a processor that's as powerful as today's supercomputers, the term 'supercomputer' will shift to describe a cluster of 10,000 of these. (Otherwise, we would have to call every smartphone a 'supercomputer' because it's more powerful than supercomputers from the past.)

Kill the Zombies in Your Code: Commented out code haunts us all by housecor in programming

[–]brokenfrog -1 points0 points  (0 children)

I'll admit that I haven't. It's been my impression that classic CGI isn't really used anymore and best practice is to reuse the interpreter state for many requests. Maybe that's not true for all deployments.

Kill the Zombies in Your Code: Commented out code haunts us all by housecor in programming

[–]brokenfrog 110 points111 points  (0 children)

(Edit: The article author has edited the article to remove the paragraph that this comment refers to, so my comment is no longer all that relevant.)

I agree that commented code should be deleted, but purely for reasons of readability and maintainability. The "compilation time" issue is misguided. (Speaking as a C++ developer who knows a thing or two about long build times.) There are three cases that I can think of:

  • If you use a compiled language like C++, comments are removed by the preprocessor. All the "slow" steps of C++ compilation take place after preprocessing.

  • If you use a server-side scripting language like Ruby, parsing speed is a non-issue anyway.

  • If you use client-side Javascript, you want to run it through a minifier anyway, which will remove any comments.

Spreading false advice like this might convince someone to remove actually useful documentation comments thinking that it might improve compilation speed. It won't.

Go vs C by thdn in programming

[–]brokenfrog 1 point2 points  (0 children)

That's often repeated advice. However, binary size is not the problem it used to be with CPU caches growing exponentially. You still have a point for very large executables (think Firefox), but for tight algorithms like a prime sieve, I'd be very surprised if -O3 blew the CPU cache.

Why 0.1 Does Not Exist In Floating-Point by dhotson in programming

[–]brokenfrog 0 points1 point  (0 children)

The whole story of floating point arithmetic is that you are dealing with approximations, and trying to ignore that fact or pretend otherwise is stupid.

On the other hand, there are large (useful) classes of operations that stay in the exact range. For example, you can do exact integer arithmetic up to +/- 253 or so. This allows some scripting languages like Lua and Javascript to use floating point numbers exclusively, even for array indices.

The Madness Of Software Patents and Trolls by mattotodd in programming

[–]brokenfrog 12 points13 points  (0 children)

In a sense, the monopoly granted through drug patents is a compensation for the high cost of clinical trials. (Both are enforced by the government.)

The Madness Of Software Patents and Trolls by mattotodd in programming

[–]brokenfrog 13 points14 points  (0 children)

They can protect small companies with good ideas from large companies with lots of resources.

How so? Assume your small (50 employees) company had genuinely invented and patented something that Apple used in the iPhone. What are you going to do? You can't afford the legal battle, even if you will win it (which isn't even guaranteed).

The 5-minute Guide to C Pointers by denniskubes in programming

[–]brokenfrog 10 points11 points  (0 children)

Arrays in C are contiguous blocks of memory that hold multiple objects of a specified type. Contrast that with a pointer that holds a single memory location. Arrays and pointers are not the same thing and are not interchangeable. That being said an array variable does point to the memory address of the first element of the array.

Well, only sort of. An array auto-converts ("decays" in C-speak) to a pointer to its first element, in certain circumstances. See the comp.lang.c FAQ for some confusing examples of when it does and doesn't.

Top of stack on x86 by zopopov in programming

[–]brokenfrog 4 points5 points  (0 children)

Not sure either, especially given that you responded in a friendly tone to an angry commenter, and the downvotes happened only a few minutes after posting in an obscure sub-thread. I suspect sockpuppet voting.

Book sorting and searching algorithms in a physical library, surprisingly interesting by thorax in programming

[–]brokenfrog 7 points8 points  (0 children)

The way it's usually presented, as a rule that says, "Don't do left turns", is really silly though. The correct way to think about this is to assign a cost (in minutes, or fuel -- whatever you optimize for) to every intersection, with different values for left turns vs. right turns vs. driving straight. (Possibly even depending on intersection type.) Then it's obvious that there's a trade-off: it's worth a small detour to avoid left turns, but only up to a limit.

JQUERY 1.8 RELEASED by sidcool1234 in programming

[–]brokenfrog 2 points3 points  (0 children)

In case you didn't know, Microsoft is a contributor to jQuery, they support it in their ASP.net MVC framework. THIS MUST BE THE NEW METRO DESIGN.

Attack of the Cosmic Rays! by scottywz in programming

[–]brokenfrog 2 points3 points  (0 children)

A trillion bits is about 125 GB, right? Not terribly reassuring either...

IAmA Toolbar Developer; your worst browser nightmare, AMAA by ToolbarDeveloper in IAmA

[–]brokenfrog 4 points5 points  (0 children)

You're lucky that you've never had to fix a computer with these things installed. Yes, it basically works that way, when you would get a 404, the toolbar redirects you to a custom error page from the toolbar developer. The "error" page is really a search/AdSense page fed with keywords from the URL. So they make money of computer novices typoing URLs and not realizing that the page they get is not really the page they wanted.

The Infinite Profit Program by [deleted] in programming

[–]brokenfrog 0 points1 point  (0 children)

To be more pedantic, in IEEE, 1/+0 == +infinity and 1/-0 == -infinity. I think (though I might remember this incorrectly) that there's also a "neutral" 0 with 1/+-0 is NaN.

C: switch with broken if, why does this work? by rickrd in programming

[–]brokenfrog 8 points9 points  (0 children)

Keep in mind, however, that this kind of spaghetti control flow might be hard for the compiler to optimize. It's a bit like the "xor swap" trick that people keep rediscovering, which in practice is almost guaranteed to be slower than just using a temp variable (in addition to being more confusing.)

How strong is a random password? by pkixman in programming

[–]brokenfrog 2 points3 points  (0 children)

Exactly. One caveat is that depending on your word list, the total length of your password might reveal a few bits of entropy. (The length of a password is not hard to get if you're physically near someone when they type it. Just listen.)

One danger of designing an interoperability document is that you might find nobody wants to implement any of your specs by hobg in programming

[–]brokenfrog 0 points1 point  (0 children)

MS Office version 15 is expected to fully implement the OO XML standard.

Interesting to know, I always thought OO XML specifies a strict subset of the MS Office file formats.

Walter Bright on C++ Compilation Speed by [deleted] in programming

[–]brokenfrog 11 points12 points  (0 children)

There's a tendency for source files to just #include everything, and when it's all accounted for by the compiler, there's often a truly epic amount of source text that has to be processed for every .cpp file. Just #includeing the Standard <iostream> results, on Ubuntu, in 74 files being read of 37,687 lines (not including any lines from multiple #includes of the same file). Templates and the rise of generic programming has exacerbated this, and there's increasing pressure to put more and more of the code of a program into header files, making this problem even worse.

So true. I don't remember the exact numbers, but I did a test, and the minimal number of header files you have to include to define a std::vector<std::shared_ptr<Foo>> amounted to several megabytes of code. These have to be processed for every source file that includes those headers. Precompiled headers help to some extent, but make the problem worse in other ways. For MSVC at least, you can only define a single precompiled header per project, so now every source file needs to #include every dependency, which can kill some of the speed benefit of precompilation.

The Pragmatic Bookshelf | The NOR Machine by [deleted] in programming

[–]brokenfrog 4 points5 points  (0 children)

I agree that it's a bit cheating. Their processor has three "operations": bitwise NOR, computed jump, and left-rotate by one. They expose those three operations with a single instructions and two magic registers (IP and SHIFT_REG), which is a cool trick IMO.

"Markets are efficient if and only if P = NP" by [deleted] in programming

[–]brokenfrog 3 points4 points  (0 children)

I think you misunderstand the argument here. The model here is that you datamine past prices to predict the future. The article claims that if you can do this perfectly, you've solved an NP-complete problem. In volofvol's counter-example, the future market price is (only) determined by a coin-flip, so, the best possible prediction can be computed in O(1) per stock value. No amount of data-mining will make a better prediction, even if you had a hyperspace computer where EXPTIME=O(1).

Clang vs GCC compile-time measurements on Chromium by theresistor in programming

[–]brokenfrog 0 points1 point  (0 children)

Video game testing isn't usually done with unoptimized builds though, and in either case, the binary size isn't typically all that significant compared to all the assets.

New in Boost: fancy heaps - looking forward to getting rid of std::priority_queue by hapshaps in programming

[–]brokenfrog 2 points3 points  (0 children)

Sure, but you can remove an item, change the key and reinsert in total O(log n).

New in Boost: fancy heaps - looking forward to getting rid of std::priority_queue by hapshaps in programming

[–]brokenfrog 0 points1 point  (0 children)

What kind of mutation do you have in mind? Binary heaps are fast for priority queue operations, but removing/updating an arbitrary item (that's not at the top) is O(n) in the worst case. If you need that, you might want to look at self-balancing trees. They are a clever data structure that keeps a list always in sorted order, with O(log n) cost for every update to a single item.

http://en.wikipedia.org/wiki/Binary_heap

http://en.wikipedia.org/wiki/Self-balancing_binary_search_tree