News for hackers. Stuff that matters.
Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by castell on Thursday June 18, 2015 @06:34AM (#9737717)
It's the same.

All iOS devices except the iPad Air 2 have less than 2GB RAM (most 512 MB). Android 1-4 devices have often less than 1GB RAM. It's common that only 1-3 apps can stay in RAM depending on the platform and the apps memory usage (foreground apps, not background services).

Applications/games in the Win95/PS1/N64 era were coded a lot more efficient. Back than, a common Win95a PC had 4-8MB RAM, (highend was 32MB).

Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by vetinari on Thursday June 18, 2015 @09:26AM (#9738342)
Win95 machines with 4 MB RAM were exceptions, not the rule. It was very painful to use such machine, as it was swapping all time time, otherwise doing nothing.

Any realistic setup had 8 MB RAM or more.

Application at that time also didn't support i18n, didn't anti alias fonts, had low-res, low-color assets, that were enough at 320x200(240)/640x480 resolution.

Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by vardump on Thursday June 18, 2015 @03:42PM (#9741140)
Windows 95 was painful to use even with 8 MB. 12 MB was minimum amount that didn't cause it to swap all the time when actually doing something. 16 MB was nice.
Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by frik on Thursday June 18, 2015 @10:58AM (#9738915)
A Pentium 133 with 8MB and 800x600 (32bit colors) run fine in with Win95a and several open applications. Try that with Android, even with 2GB RAM and quad core CPU - the Java based system on top of Linux is quite resource hungry. Flagship Android 5 phones have at least twice the hardware spec (twice as much RAM and CPU) of the iPhone 6 and are comparable in performance and user experience (latency) and not faster. That's the difference of Object-C vs. Java. And old applications like Microsoft Office are all coded in C/C++ and parts of older applications in Assembler.
Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by vetinari on Thursday June 18, 2015 @12:32PM (#9739738)
One icon in Win95 had 512 bytes (32x32, 16 color, 4 bitplanes). One icon in Android has 256 kB (256x256, true color). The 800x600, 16-bit hicolor (that's what I used at the time) framebuffer had a bit under 940 kB. The 1920x1200 truecolor has 8,8 MB, not counting the texture backing stores used by modern display servers.

The amount of RAM needed has to do with assets used by the code, not the code itself. The code itself is miniscule.

And no, Android phones do not have 4 GB RAM. Low end has 512 MB, with many phones in 1-1,5 GB range and the 2015 flagships have 3 GB. (Nexus 5 a 7 have 2 GB. Nexus 6 has 3 GB). All that without swap (where would you like to swap? To flash?). While most modern 32-bit ARM CPUs do come with LPAE, Android does not support that, so going above 4 GB will have to wait for ARMv8.

Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by vardump on Thursday June 18, 2015 @06:55PM (#9742086)
Android doesn't support LPAE? That's pretty surprising, any sources about that? LPAE doesn't need any usermode support to function. What specifically does Android do to prevent using LPAE in underlying Linux kernel?
Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by vetinari on Friday June 19, 2015 @06:53AM (#9743964)
Well, one thing is what Linux kernel supports by itself, other is, what does the board support package for your chipset. So maybe there is LPAE Android device somewhere, where the SoC provider did bother, but in general, nobody does.
Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by rosege on Friday June 19, 2015 @12:48AM (#9743060)
my android phone does :-) asus ze551ml
Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by vetinari on Friday June 19, 2015 @06:55AM (#9743971)
You phone is also Intel based, not ARM. That opens another question - would Intel be able to make phone SOCs, if Android SDK would compile to native ARM code, as some advocates prefer?
Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by pjmlp on Thursday June 18, 2015 @11:25AM (#9739137)
Java is not the problem, rather Google's shitty compilers.

Lots of industrial applications run embedded Java with a few KBs and acceptable performance for their use cases.

Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by lern_too_spel on Thursday June 18, 2015 @03:36PM (#9741114)
Android used the Oracle javac compiler until this year, so blaming anything on Google's new compilers is a little strange.
Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by pjmlp on Thursday June 18, 2015 @04:39PM (#9741484)
That comment shows how much you understand about compilers and Android.

javac has nothing to do with Dalvik or ART.

Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by lern_too_spel on Thursday June 18, 2015 @06:58PM (#9742091)
That shows how little you understand about the Android build tools. Dalvik and ART are not compilers.

Prior to this year, javac compiled the Java code to .class files and then dx translated the Java bytecode in the .class files into Dalvik bytecode in a .dex file, with some simple dedupe optimizations.

Only this year did the Android build system switch to Google's own compiler.

Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by pjmlp on Friday June 19, 2015 @12:39AM (#9743031)
Go take a degree in computer science, learn about intermediate code representation, compiler frontened, compiler backend, CPU instructions, JIT compiler, AOT compiler, register selection.

Then make little drawings about which piece of Android is converting intermediate code representation into native CPU instructions.

For brownie points compare the quality of generated Asssembly code between Hotspot, Dalvik and ART for the same unmodified jar file.

Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by lern_too_spel on Friday June 19, 2015 @03:21AM (#9743398)
Already done and wrote a non-optimizing lisp compiler and an optimizing toy compiler with common subexpression elimination and fancy register allocation.

I gather from your response that you've realized you were wrong about Android not using javac but were too proud to admit it. Don't worry, we can fix your pride problem with these tasks below:

1. Dalvik and ART don't take jar files as input, so it is impossible to get your brownie points. Learn why.

2. Oracle's Hotspot targets x86 and x86-64, and Dalvik and ART are mostly focused on ARM. Learn the difference between ISAs.

3. Hotspot and Dalvik make different tradeoffs between CPU and memory both in their choices of garbage collectors and in their JIT strategies. Think about why that would be.

4. The word "compiler" by itself refers to a program that translates source code into object code. Notably, an assembler is not usually considered to be a compiler, and JIT "compilers" were originally called dynamic translators for three decades, with JIT compiler only appearing in the 90s. Given that terminology background, figure out why most people would call javac a compiler but not Hotspot or Apple's Rosetta.

Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by pjmlp on Tuesday June 23, 2015 @06:57AM (#9763807)
> Already done and wrote a non-optimizing lisp compiler and an optimizing toy compiler with common subexpression elimination and fancy register allocation.

And yet failed to grasp the difference between frontend, backend and intermediate execution format.

> I gather from your response that you've realized you were wrong about Android not using javac but were too proud to admit it. Don't worry, we can fix your pride problem with these tasks below:

I don't have to acknowledge anything. Anyone knows that javac does not execute code on the Android platform. As such talking about whatever influence it might have on runtime performance, besides peephole optimizations, constant folding and similar AOT optimizations only reveals ignorance about the Android stack.

> 1. Dalvik and ART don't take jar files as input, so it is impossible to get your brownie points. Learn why.

Yes they do. Jar files get converted into dex files, which means the same file can be used as canonical input for both platforms.

Then again we are learning about Android aren't we?

> 2. Oracle's Hotspot targets x86 and x86-64, and Dalvik and ART are mostly focused on ARM. Learn the difference between ISAs.

Maybe you are the one that should inform yourself about Oracle and certified partners Java JIT and AOT compilers for ARM platforms.

Learn about the Java eco-system.

> 3. Hotspot and Dalvik make different tradeoffs between CPU and memory both in their choices of garbage collectors and in their JIT strategies. Think about why that would be.

Of course they do different tradeoffs. The ones made by Dalvik and ART are worse than approaches taken by other Java vendors, hence why they generate worse code, which leads to bad performance.

Learn about commercial embedded JVMs.

>4. The word "compiler" by itself refers to a program that translates source code into object code. Notably, an assembler is not usually considered to be a compiler, and JIT "compilers" were originally called dynamic translators for three decades, with JIT compiler only appearing in the 90s. Given that terminology background, figure out why most people would call javac a compiler but not Hotspot or Apple's Rosetta.

Learn about Xerox PARC documentation and its references JIT compilers.

Or better yet feel free to dive into OS/400 documentation about its kernel level JIT compiler.

All of which go back a little earlier than the 90's

Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by stuaxo on Thursday June 18, 2015 @05:25PM (#9741696)
Interesting... Fast 486 (120mhz) with 12mb at 640x480 was swapping my so much fun could watch the logo screen rendering slowly down the screen
Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by vetinari on Friday June 19, 2015 @06:58AM (#9743980)
I remember 386DX (40 MHz) with 4 MB to be unusable at all (yes, it was possible to install Win95, but that's all) and Pentium 120 with 16 MB and S3 card running 800x600 hicolor to be great. In 1996.
Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by kayoone on Thursday June 18, 2015 @08:50AM (#9738189)
I actually worked on a game that was running on the iPad2 (some gameplay https://www.youtube.com/watch?v=uaq0Sfp3_5Q ) and while you had to optimize quite a bit to achieve a certain number of drawcalls and memory usage it was still developed in Unity and far from what devs did in the ps1/2 era.
Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by codesushi42 on Thursday June 18, 2015 @07:07AM (#9737814)
Except unlike smartphones, the PS1/N64 did not support VM or even had any storage to page to. So no, it's not the same.
Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by pjmlp on Thursday June 18, 2015 @08:01AM (#9738008)
iOS documentation:

"Instead, if the amount of free memory drops below a certain threshold, the system asks the running applications to free up memory voluntarily to make room for new data. Applications that fail to free up enough memory are terminated."

Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by kayoone on Thursday June 18, 2015 @10:30AM (#9738699)
That has nothing todo with what op is referring to. Even on iOS you have a virtual memory system, like a normal PC does. If your app runs out of ram it will page to storage and the OS handles this for you. The PS1/N64 did not have any storage beyond RAM and also no virtual memory management so you had to write all the paging from CD/Cartridge to RAM yourself. Quite a difference.
Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by Cthulhu_ on Thursday June 18, 2015 @11:16AM (#9739055)
Sort of. iOS does have a virtual memory system, but it's not as forgiving as a full OS would be; applications that fail to free up memory when asked to (i.e. in a low memory situation) are killed by the OS. See also: https://developer.apple.com/library/mac/documentation/Perfor...
Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by kayoone on Thursday June 18, 2015 @11:49AM (#9739346)
That should be much easier to optimize against vs having no paging at all though. Are Apps running in the background asked to free up storage or be killed before the active app needs to do the same or are they referring to the active app ?
Re:How Naughty Dog Fit Crash Bandicoot into 2MB of RAM on th... by pjmlp on Thursday June 18, 2015 @12:37PM (#9739783)
Background apps are even worse, as by default they are suspended.

If the system requires memory the ones with higher memory footprint are the first ones to go. They aren't asked nicely, just killed.

This might have changed on newer versions though. I am typing this from memory.

Also on the Watch there are also time constraints. How quick an app is allowed to execute.

Windows Phone also has similar constraints.