Live data from Hacker News

Chess.com stopped working on 32bit iPads because 2^31 games have been played

chess.com

221–230 of 338 posts

Re: Chess.com stopped working on 32bit iPads because 2^31 games have been played

#221

Earlier quoted context omitted.

Your link discusses 2^64, which applies to languages that have native integer types. The 2^53 problem was for Javascript, which has no native integer type, and is thus limited by the mantissa size of Number (which is defined as an IEEE double-precision float). Twitter ids are unsigned 64-bit, since they're generated using Snowflake. That link must pre-date the move to snowflake ids, and is speaking to the count of tw…

I'd be incredibly surprised if they overflowed 9 quadrillion tweets. That's like a million tweets per person on earth.

Haha, sorry, that thought was in reference to the link saying they hadn't overflowed 2^31 yet. Two billion seems believable for tweets as of 2013.

Re: Chess.com stopped working on 32bit iPads because 2^31 games have been played

#222
post #56

Earlier quoted context omitted.

Nope. Definitely not goofy. My dad was a programmer in the early days. The machines he started on in the 1960s had 8 KB of RAM. Saving a byte then is the equivalent today of saving 1 MB on an 8 GB machine. Multiply that times, say, the thousands of customer orders you're trying to process and the goofy thing would be burning a lot of additional RAM because it might help somebody 35 years later. Who among us is writin…

Last time this came up, I ran the numbers and the cost of the RAM saved per date stored was hundreds of dollars. Not per computer, or per program, but per date . Comparing total memory sizes doesn't tell the whole story, because RAM for a whole machine is so much cheaper now. Spending that much money on storing "19" just so your code keeps working in the unlikely event that it's still in use 3+ decades into the futur…

Excellent point. Yeah, the machines my dad started on had magnetic core memory [1]. Each bit was a little metal donut with hand-wound wiring.

And in some ways, even "hundreds of dollars per date" doesn't quite convey it. These machines were rare and fiendishly expensive. In 2017 dollars, they started at $1M and went up rapidly from there. Getting more memory wasn't a quick trip to Fry's; even if you could afford it and it was technically possible, it was a long negotiation and industrial installation.

Another constraint that we forget about is the physicality of storage. Every 80 columns was a whole new punch card. That's a really big incentive to keep your records under 80 characters. Each one of those characters took time to punch. Each new card required physical motion to write and read, and space to store.

There were just so many incentives to make do.

https://en.wikipedia.org/wiki/Magnetic-core_memory

Re: Chess.com stopped working on 32bit iPads because 2^31 games have been played

#223

Earlier quoted context omitted.

But a 2 digit date should take less than 7 bits. Were they using systems that didn't use 8 bit bytes? Why wouldn't the dates work from, say 1900 to 2155?

My understanding is that the actual number of bits used would generally have been 4 bits per digit, as they were using Binary Coded Decimal [1]. So dropping the 19 would save you a byte per date. Sure, they could have used a custom encoding. But that increases maintenance cost and extra development work. All to solve a problem that nobody cared about at the time. [1] https://en.wikipedia.org/wiki/Binary-coded_decimal

Just seems wierd. A 2 byte day count would give a huge range and use 2 bytes for the full date Vs 3 bytes for a BCD yymmdd representation.

Re: Chess.com stopped working on 32bit iPads because 2^31 games have been played

#224
post #46

Earlier quoted context omitted.

This is a whole class of problem - I wonder if there's a name for it. More examples include: talking about welfare being unnecessary because no one is starving. Or people on medications stopping because they feel better (while still on them).

I think this is actually a version of confirmation bias since > Confirmation bias, also known as Observational selection or The enumeration of > favorable circumstances is the tendency for people to (consciously or > unconsciously) seek out information that conforms to their pre-existing view > points, and subsequently ignore information that goes against them, both > positive and negative [0] [0] http://rationalwiki…

You'll find confirmation bias everywhere if you look hard enough for it.

Re: Chess.com stopped working on 32bit iPads because 2^31 games have been played

#225
post #8

Self-confidence as a programmer is when starting a new project, storing the transaction ID as a long rather than an int...

So when is it self-confidence and when is it overengineering and invoking the wrath of YAGNI? :P

Re: Chess.com stopped working on 32bit iPads because 2^31 games have been played

#226
post #46

Earlier quoted context omitted.

Similar to how much effort goes into dealing with things like dangerous strains of bird flu, only to have people complain about how much money was spent on "nothing" when an outbreak doesn't occur.

This is a whole class of problem - I wonder if there's a name for it. More examples include: talking about welfare being unnecessary because no one is starving. Or people on medications stopping because they feel better (while still on them).

It's a form of (inverse) Survivorship Bias. "None survived, therefore none started out" is an (inverse) extension of "The ones that survived were the ones that started out".

Re: Chess.com stopped working on 32bit iPads because 2^31 games have been played

#227
post #224

Earlier quoted context omitted.

I think this is actually a version of confirmation bias since > Confirmation bias, also known as Observational selection or The enumeration of > favorable circumstances is the tendency for people to (consciously or > unconsciously) seek out information that conforms to their pre-existing view > points, and subsequently ignore information that goes against them, both > positive and negative [0] [0] http://rationalwiki…

You'll find confirmation bias everywhere if you look hard enough for it.

I'm looking hard enough to see what you did there.

Re: Chess.com stopped working on 32bit iPads because 2^31 games have been played

#228
post #183

Earlier quoted context omitted.

It also could've been just the person picking an int over a long. Is ints vs. longs the first place to look for optimizing efficiency/performance?

On a 32-bit system, a "long" is usually also 32 bits. On a non-Microsoft 64-bit system, a "long" is usually 64 bits. On both 32-bit and 64-bit systems (Microsoft or not), an "int" is usually 32 bits. If the issue happened only on 32-bit iPads, but not on 64-bit iPads, the programmer probably picked a "long", not an "int". Had the programmer picked an "int", the problem would also happen on 64-bit iPads.

Our iOS app with Java backend was using long for database IDs on both ends. I was going through the ILP32->LP64 conversion process and when I realized we had a pretty serious discrepancy.

I think it's a really easy mistake for the first developer to make (especially because they weren't a C/Obj-C programmer), and then the sort of thing that no one audits after that.

Re: Chess.com stopped working on 32bit iPads because 2^31 games have been played

#229
post #56

Earlier quoted context omitted.

Nope. Definitely not goofy. My dad was a programmer in the early days. The machines he started on in the 1960s had 8 KB of RAM. Saving a byte then is the equivalent today of saving 1 MB on an 8 GB machine. Multiply that times, say, the thousands of customer orders you're trying to process and the goofy thing would be burning a lot of additional RAM because it might help somebody 35 years later. Who among us is writin…

But a 2 digit date should take less than 7 bits. Were they using systems that didn't use 8 bit bytes? Why wouldn't the dates work from, say 1900 to 2155?

Back in the days it was probably 7 bits, but the word size is not that important. The problem still exists today with a modern 64 bit computer:

Even if a system internally can store a timestamp with nanosecond precision since the beginning of the universe, all that precision is lost when communicating with another system if it must send the timestamp as a six character string formated as "yymmdd" in ASCII.

Re: Chess.com stopped working on 32bit iPads because 2^31 games have been played

#230

Earlier quoted context omitted.

My understanding is that the actual number of bits used would generally have been 4 bits per digit, as they were using Binary Coded Decimal [1]. So dropping the 19 would save you a byte per date. Sure, they could have used a custom encoding. But that increases maintenance cost and extra development work. All to solve a problem that nobody cared about at the time. [1] https://en.wikipedia.org/wiki/Binary-coded_decimal

Just seems wierd. A 2 byte day count would give a huge range and use 2 bytes for the full date Vs 3 bytes for a BCD yymmdd representation.

There are a lot of weird things...

You are assuming 8 bits per byte, but a byte can be any number of bits.

With two bytes of 7 bits each, the range is only about 40 years. Is is also impractical when the storing media is punch-cards, and the systems adder unit only counts in binary coded decimal.

Post reply on HN