Slashdot Mirror


Why JavaScript On Mobile Is Slow

An anonymous reader writes "Drew Crawford has a good write up of the current state of JavaScript in mobile development, and why the lack of explicit memory handling (and a design philosophy that ignores memory issues) leads to massive garbage collection overhead, which prevents HTML5/JS from being deployed for anything besides light duty mobile web development. Quoting: 'Here’s the point: memory management is hard on mobile. iOS has formed a culture around doing most things manually and trying to make the compiler do some of the easy parts. Android has formed a culture around improving a garbage collector that they try very hard not to use in practice. But either way, everybody spends a lot of time thinking about memory management when they write mobile applications. There’s just no substitute for thinking about memory. Like, a lot. When JavaScript people or Ruby people or Python people hear "garbage collector," they understand it to mean "silver bullet garbage collector." They mean "garbage collector that frees me from thinking about managing memory." But there’s no silver bullet on mobile devices. Everybody thinks about memory on mobile, whether they have a garbage collector or not. The only way to get "silver bullet" memory management is the same way we do it on the desktop–by having 10x more memory than your program really needs.'"

6 of 407 comments (clear)

  1. Easy by ArcadeMan · · Score: 5, Interesting

    Stop loading dozens of fucking libraries and frameworks and learn to really code.

    1. Re:Easy by Anonymous Coward · · Score: 5, Insightful

      We already know how to "really code". We just got sick of reinventing the wheel every time we start a new project. Now we let the libraries do the tedious crap, and we focus our attention on where it's actually needed.

      You're going to use our library-heavy code, and you're going to like it. You already do, in fact. You're lying when you pretend otherwise.

    2. Re:Easy by Anonymous Coward · · Score: 5, Funny

      Stop loading dozens of fucking libraries and frameworks and learn to really code.

      Because *REAL* programmers don't use libraries or frameworks. In fact, *REAL* programmers don't even use wussy text editors like vi or emacs; they use butterflies.

  2. always by Spaham · · Score: 5, Insightful

    You always need to think about memory. Like you need to think about what you're doing.
    Too bad for the "write app get rich" idiots.

  3. Re:That's just not a viable option. by ShanghaiBill · · Score: 5, Insightful

    Even if you don't use jQuery, for example, you're going to need to find and then use some other library that does the same thing

    Furthermore, popular libraries like jQuery, Mobile-jQuery, etc. are much more likely to have clean, efficient, memory-lite implementations that some "roll-your-own" code. If you choose your libraries carefully, learn to use them, and avoid "rolling-your-own" unless really necessary, your code will certainly be smaller and cleaner, and usually be faster, smaller, and use less memory.

  4. Re:That's just not a viable option. by mypalmike · · Score: 5, Funny

    > Yet C developers... rarely depend on shitloads of libraries.


    $ ls -l /usr/lib | wc -l
    shitloads

    --
    There are 0x40000000 types of people: those who understand 32-bit IEEE 754 floating point, and those who don't.