HNHacker News
TopNewBestAskShowJobs

derf_

2,803 karma · joined July 22, 2012

submissionscomments
derf_··on Tis-interpreter – find subtle bugs in programs written in standard C
> I'd be interested to know how you define, say, signed integer overflow (keep in mind, most DSP architectures don't use two's complement)

Basically every DSP uses two's complement, and pretty much everything else besides, and has for decades. Most things that give different results based on the representation of negative numbers are merely implementation-defined, anyway. Signed overflow is undefined for a different reason.

  for (i = 0; i < n; i++) {
    foo();
  }
Does that loop execute n times, or (4,294,967,296 + n) times? If signed overflow is undefined, the compiler can assume n is non-negative. If it's even just implementation-defined, the compiler has to check. That in turn may eliminate a whole host of potential optimizations the compiler might have been done.

In general I agree with your point, though. If those kinds of optimizations don't matter to you, you shouldn't be using C. If you want the option for your loops to run (4,294,967,296 + n) times in C, use unsigned arithmetic. Its overflow behavior is well-defined.

derf_··on WordPress.com turns on HTTPS encryption for all websites
Is it not live yet? The article uses the present progressive "is activating", but e.g., https://whatever.scalzi.com serves a certificate whose CN is *.wordpress.com (i.e., one that is invalid for the intended domain).
derf_··on Save Netflix
> I think we need to focus far more on hardware - it's never looked darker...

On the contrary, the slowdown of Moore's Law means the future has never been brighter for open hardware. Someone could actually design something for a process that hasn't been obsolete for over two years and still have a hope of getting it manufactured before it becomes that way.

derf_··on How Safe Browsing Works in Firefox
Since Firefox 41 [1] Safe Browsing traffic all uses https, so it should not be vulnerable to passive collection techniques like XKeyScore.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1109475

derf_··on Compiler Bugs Found When Porting Chromium to VC++ 2015
For an example of what Greg Maxwell might consider "adequate testing", see https://www.ietf.org/proceedings/82/slides/codec-4.pdf (he is the one responsible for all of the testing described in that presentation).

Slide 20 lists no less than 8 toolchain bugs found with a codebase of less than 50k lines of C code (no C++), using only thoroughly trodden language features, without "massive functions" or anything else. Admittedly 4 of those bugs were in pre-release versions of gcc, but the rest weren't.

derf_··on How One Hardware Startup Solved Silicon Valley’s “Woman Problem” (2015)
Yeah, so here's the thing:

1. Your job application probably has language that discourage women from applying [1].

2. Men tend to apply for jobs even though they don't meet all of the qualifications, whereas women tend not to [2].

So there's bias introduced before you even see the list of applicants, and given no other information, it would not be that surprising to find a randomly selected woman from that candidate pool would be more qualified than a randomly selected man.

[1] http://www.huffingtonpost.com/2015/06/02/textio-unitive-bias...

[2] http://www.theatlantic.com/magazine/archive/2014/05/the-conf...

derf_··on 3-D Depth Reconstruction from a Single Still Image (2007) [pdf]
I re-implemented the techniques described here for a former employer (which sadly means I also cannot release the code). I was able to reproduce the quoted performance figures (both accuracy according to the paper's metrics and execution time), but the actual quality of the output was not very good.

Something like > 90% (number hazy based on vague recollection) of images produced results that had gross, glaring errors that would be unacceptable to a human. Errors like, "We added a horizon line where there wasn't one in the actual image," etc. But a few images produced compellingly plausible results.

It's still very interesting stuff, and some of his later work on using this as an additional prior for more normal structure-from-motion pipelines looked pretty promising. In the form reported in this paper it wasn't something ready to be productized. Although it's also completely possible that I just screwed something up.

derf_··on What a PhD Really Means in the US National Security Community
This is correct. When I was a Ph.D student I was told that it was very rare for someone to fail their thesis defense, because their advisor will not let them defend until they know they are going to pass. It does happen, but it takes a special kind of effort and means your advisor screwed up.
derf_··on STOKE – a stochastic optimizer for x86_64 assembly
I applied this to some pieces of Daala's entropy coder: https://review.xiph.org/763/#msg2

The output needs a bit of manual review (see the mixing of 32-bit and 16-bit accesses to the same register in the second example), but it was definitely able to find something non-obvious in a sequence far too long for exhaustive search.

derf_··on You Can't Destroy the Village to Save It: W3C vs. DRM, Round Two
It's worse than that. Competition drives price to zero. That means DRM providers need to get their revenue from some other way. The obvious way is to exploit (track, or worse) the user.
derf_··on H.265/HEVC vs. H.264/AVC: 50% bit rate savings verified
This is the progress for the past year:

https://arewecompressedyet.com/?r[]=master-2016-01-01-082473...

Select "Entire curve (old method)" to see BD-rate numbers (the new method requires data overlap in all three bitrate ranges in order to work, which the old curve does not have).

derf_··on YouTube change served lower-quality video to Firefox 43 for 2 weeks
> HN on firefox is bad. Comments doesn't have any hierarchy.

On desktop, at least, you can fix this by making your browser window wider (just resize the window: you'll find a threshold past which the hierarchy appears or disappears).

That doesn't help much for mobile, where you can't really resize windows.

derf_··on End-of-buffer checks in decompressors
...if after swapping buffers around, our input cursor hits the mark again, we just hit the refill path again to generate more zeroes. (This is why the copying code uses memmove).

This misses one more optimization: if you consume bits by shifting them off the end of your word, then you are shifting in zeros in their place. If your semantics are that all reads past the end of the buffer return zeros, then once you have hit that end, you can just set bitcount to LOTS_OF_BITS (an arbitrarily large constant).

That is, you pretend your 32-bit word has a lot more than 32 bits in it. Then you're extremely unlikely to ever hit the refill code again. For extra points, you can make the constant something that can easily be represented as an ARM immediate, like 0x40000000.

We do this in the bitreaders for Theora, Opus, and Daala (thanks to Simon Hosie for contributing the idea to Theora back in the day).

derf_··on Interview with Michael Burry, Real-Life Market Genius From The Big Short
I was lucky---when I was born in 1930, I won the ovarian lottery. You know, I was born in the United States. The odds were 30 or 40 to one against that. I was born white. If I had been born black, my life would have been different. I was born male. My life would have been vastly different if I had been born female.

So, I had all kinds of lucky things.

-Warren Buffett, 4 Oct. 2011 [1]

Certainly Michael Burry had enormous luck. But there were plenty of others with the same amount of luck who did not see the crisis coming or who did nothing about it.

[1] http://fortune.com/2011/10/04/warren-buffett-at-fortunes-mos...

derf_··on Trying to speed up binary search
You can also change the memory layout to that of a binary heap, instead of the usual sorted order. That puts the next index at either (2i + 1) or (2i + 2). With proper alignment, those will be in the same cache line up to 4 iterations in the future, regardless of which way you descend the tree. So you can do a branchless prefetch version with much better than a 50% prefetch accuracy. This only helps once you're hitting L3 cache, though.

See https://news.ycombinator.com/item?id=10410676 for previous discussion.

derf_··on The Mystery of Missing Inflation Weighs on Fed Rate Move
In the search for new models I've always been partial to the inclusion of credit (marked to market) as a factor in predicting inflation, instead of just money supply. This at least correctly predicted low-to-no inflation post-financial-crisis despite massive increases in the money supply.

http://www.economicsjunkie.com/inflation-deflation-revisited... has some good explanations of why.

There's also what you measure: consumer prices do not reflect increases in asset prices, and the latter have grown very quickly in the past few years (as credit has recovered).

derf_··on A Back Door to Encryption Won't Stop Terrorists
This is basically a solved problem for supersonic ammunition (not fired from a silenced weapon): https://en.wikipedia.org/wiki/Boomerang_%28countermeasure%29 (not to suggest in any way that the proposal is practical on a wide scale).
derf_··on Science papers rarely cited in negative ways
When I was a grad student, I was explicitly advised to make such citations uncritical. Instead of saying, "Researchers A, B, and C failed to consider cases X, Y, and Z, which we address here," you would say, "Researchers A, B, and C solved this problem under the assumptions that X, Y, and Z were not issues. We extend their work here to handle these cases." That is, you say what they achieved, rather than what they didn't.

Everyone wins with this approach. Sure, those lazy bums didn't consider cases X, Y, and Z, but then no one else had solved the problem regardless of whether or not they handled X, Y, or Z. That's how A, B, and C's results got published!

You're building on their work. You look better for acknowledging it rather than trying to knock down those who came before. They are likely to be respected quite a bit better than you are. Also, researchers A, B, and C are the most likely candidates to be reviewing your paper. So there's that.

This is, of course, orthogonal to the issue of unreproducible experimental results.

derf_··on Memory Layouts for Binary Search – V2
For those who want a bit more than "we trade bandwidth for latency" and a bit less than a 43-page paper (not to discourage anyone, it's very well-written):

In a binary-heap ("Eytzinger") layout, the next node to consider is at either index (2i + 1) or (2i + 2). That means you can perfectly predict the next cache line to load. This continues to be true up to four iterations in advance (assuming proper alignment, for 4-byte data with 64-byte cache lines, holding 16 values each). Speculative execution will begin these loads early, regardless of whether the branch prediction is ultimately successful. A branch-free algorithm can do the same with explicit prefetch instructions to avoid the pipeline stalls of mis-prediction. However, in each cache line, you only look at one value (1/16th of the data transferred).

You can attempt to pack the data for several iterations into a single cache line to increase utilization. However, because a complete binary tree has 2^n - 1 values (i.e., because it is odd), there are some small inefficiencies. For example, four iterations of a binary search require (1 + 2 + 4 + 8) = 15 possible values, of which you will look at four (1/4 of the data transferred, given the same 16-element cache line size). But either you include an extra element and thus sometimes need 5 comparisons instead of 4 (B-tree algorithm), or you mis-align the subtrees with cache line boundaries (van Emde Boas algorithm), or you waste space by only putting 15 values in a cache line (not tested). And you can't issue the load for the next cache line until the current subtree search completes.

Even though the latter approaches have up to four times better utilization of the data they load, as long as the bandwidth-delay product is at least 4 cache lines (i.e., you can issue 4 requests in parallel without slowing any of them down), the Eytzinger approach will win. They measured the bandwidth-delay product at 4.7 on their machine, and overall algorithm comparisons seem to be consistent across over 100 different CPUs.

If the data fits in L2 cache (2^16 values), a branchless prefetching algorithm on a simple sorted array is still slightly faster than using the Eytzinger ordering, just because of constant factors. The difference is small (15%ish on average, estimating from the plots).

Some broken CPUs (Phenom II, Celeron J1900, E3-1230) seem to cause large slowdowns when prefetching invalid addresses. Masking the address fixes the problem with no measurable performance impact on non-broken CPUs.

derf_··on If You're Not Paranoid, You're Crazy
Don't be ridiculous. Tin-foil hats amplify exactly the frequencies used by the US government and large multinationals for GPS and mobile phone tracking: https://web.archive.org/web/20100708230258/http://people.csa...
derf_··on Paris city centre goes car-free for a day
I was in Paris last week. On Monday, trying to head to the airport from Porte de Clichy (on the 13 line), I failed to board two subway trains in succession. They were so jam-packed with people I could not physically get on the cars. It was not for lack of effort: I have ridden the Tokyo subway during rush hour, so I am not shy.

After two failed attempts, I left the station and caught a taxi.

I am not saying Paris does not have a very good train system compared to many places, but it seems to me it would not be so easy to expect it to handle all of the people who currently drive.

derf_··on Bugzilla CVE-2015-4499: All Your Bugs Are Belong to Us
It is important to point out that access to security bugs (the ones that contain descriptions of unpatched vulnerabilities) is not automatically granted to all Mozilla employees, so simply having an @mozilla.com e-mail is not enough to get information on how to exploit Firefox.

It is enough to get access to potentially sensitive partner information (as can be seen from the posted screenshot), but those are usually a different class of bugs from security bugs.

Further, we now classify security bugs by the area of the code they affect, and give engineers access to just the areas for which they are responsible, rather than blanket access to all security bugs. This is a process that began even before the recent attacks, but we have been pushing it more aggressively in their wake.

derf_··on The mystery of the fifteen-millisecond breakpoint instruction
I don't know what gdb does, but even on x86 a conditional breakpoint can be ridiculously slow. On a loop that executes a few hundred thousand times before meeting the condition, it can take minutes to evaluate something that executed instantly before.

I often go back, edit the code to add something like

  if (condition) {
     foo = foo;
  }
recompile, restart the debugger, and break on the foo = foo line. Even with all of those steps, that's still faster than using a conditional breakpoint most of the time.
derf_··on Forging an Alliance for Royalty-Free Video
Please see the "Other disclosures" section on https://www.opus-codec.org/license/

You may also be interested in https://hacks.mozilla.org/2013/02/defending-opus/ (warning: contains discussion of specific, unexpired patents).

derf_··on Forging an Alliance for Royalty-Free Video
We ran the Opus license terms by the FSF before publishing them, and they confirmed that the terms were compatible with the GPL (v3 or otherwise).
derf_··on Forging an Alliance for Royalty-Free Video
We are absolutely talking with Apple, and hope they will decide to join.
derf_··on Thor – A Project to Hammer Out a Royalty Free Video Codec
Hello, I'm the Daala tech lead.

One of the things that made Opus a success was the contributions of others. We certainly don't have a monopoly on good ideas. We'll take pieces of Daala and stick them in Thor and pieces of Thor and stick them in Daala, and figure out what works best. Some of that experimentation has already begun:

https://github.com/cisco/thor/pull/8

https://review.xiph.org/874/

https://www.ietf.org/proceedings/93/slides/slides-93-netvc-5...

Because none of us have a financial incentive to get our patents into the standard, we're happy to pick whatever technology works best, as long as we end up with a great codec at the end. Hopefully NETVC can replicate the success of Opus this way.

derf_··on G is for Google
I've seen a lot of comparisons to Berkshire. Not every large conglomerate is Berkshire.

Berkshire is composed of pre-existing businesses that were themselves successful before being purchased. They are not experimental ventures that need to be subsidized. It is exactly the opposite: money is plowed into the strongest businesses. They each generate excess cash, and it is easier to reinvest that cash in some places than others. The conglomerate structure makes it possible to put the cash where it gets the best returns without having to pay taxes or transaction fees.

Alphabet has none of these properties, except the ability to allocate capital tax-free, but they already had that as Google.

derf_··on The Emergence of IP Norms and the Transformation of Stand-Up Comedy (2008) [pdf]
https://www.boston.com/entertainment/2015/07/28/man-claims-c...

So much for no lawsuits.

derf_··on Warren Buffett: Thriftville vs. Squanderville (2003) [pdf]
My first question was: how did the statistics he's quoting change in the subsequent dozen years?

Charts of 2007-2015 Q1: https://www.bea.gov/newsreleases/international/intinv/intinv...

More detailed data back to 1976: https://www.bea.gov/international/bp_web/tb_download_type_mo...

In short, the U.S. is now $7 trillion in the hole (39% of GDP), and most of that damage has been done in the past 5 years. In 2007 that hole was just $1.35 trillion. In 2014 alone the U.S. position worsened by $1.7 trillion.

-$1.2 trillion of this was due to exchange rates: other countries are running their printing presses faster than the U.S. is, so it is losing the competitive currency debasement race kicked off in 2008. This is not news, but it makes this number worse because it causes U.S. assets held by foreigners to appreciate faster relative to foreign assets held by U.S. citizens.

Price changes contributed another -$0.35 trillion. That is, even in local currencies, U.S. investments made by foreigners had a better return than foreign investments held by U.S. citizens.

Then all the way down at -$0.24 trillion was "net financial transactions", or the trade deficit, which is the thing Buffett's IC proposal would actually be able to control.

In other words, unless I have misunderstood something, balancing the trade deficit, or even running a substantial surplus is not going to solve these problems at the rate they are going. The question is how much of the current trends are sustainable.

← PreviousPage 12 of 17Next →