PDA

View Full Version : Gangnam Style Has Been Viewed So Many Times It Broke YouTube’s Code



PorkChopSandwiches
12-04-2014, 05:26 PM
http://i.imgur.com/QlqvOjI.gif

Whoops!

Just a fun bit of trivia for the coders out there: PSY’s Gangnam Style has been viewed so many times that it broke YouTube’s view counter, making it the very first video to break the reaches of a 32-bit integer.

Here’s what YouTube had to say on the topic:

http://i.imgur.com/1ymlBJb.png

Not sure what the hell that means? Just know that when you’re coding, you often have to consider how you’re storing data like numbers. Do you want a 32-bit integer, or a 64-bit integer? A 32-bit integer* takes up a bit less memory, but can only be used to store numbers from −2,147,483,648 to 2,147,483,647. A 64-bit integer is a bit heftier in its memory usage, but can store numbers from −9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.

(* WE’RE IGNORING THE MATTER OF SIGNED/UNSIGNED INTEGERS FOR THE SAKE OF SIMPLICITY HERE)

You know the Pac Man kill screen, where things freak the hell out after level 256? Similar idea, just with 8-bit numbers versus 32-bit.

As of yesterday’s landmark and subsequent code change, YouTube can now theoretically support videos with up to 9 quintillion views. Get to watchin’.

DemonGeminiX
12-04-2014, 05:44 PM
A counter doesn't need to use signed integers. Yeah I know, they're not counting it, but it's relatively easy to sort out in code for most languages.

In C/C++, the declaration looks like this:


unsigned int a

That's all there is to it. Pretty simple.

PorkChopSandwiches
12-04-2014, 06:21 PM
Its probably a DB field setting

bigint -2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807) 8 Bytes

int -2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647) 4 Bytes

smallint -2^15 (-32,768) to 2^15-1 (32,767) 2 Bytes

tinyint 0 to 255 1 Byte

Hugh_Janus
12-04-2014, 07:16 PM
Its probably a DB field setting

bigint -2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807) 8 Bytes

int -2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647) 4 Bytes

smallint -2^15 (-32,768) to 2^15-1 (32,767) 2 Bytes

tinyint 0 to 255 1 Byte

that's what I was thinking tbh

















































http://i58.tinypic.com/2aj8ai9.jpg

PorkChopSandwiches
12-04-2014, 07:20 PM
:lol:

deebakes
12-05-2014, 12:01 AM
:rofl: