Slashdot Mirror


How Maintainable Is the Firefox Codebase?

An anonymous reader writes "A report released this morning looks at the maintainability level of the Firefox codebase through five measures of architectural complexity. It finds that 11% of files in Firefox are highly interconnected, a value that went up significantly following version 3.0 and that making a change to a randomly selected file can, on average, directly impact eight files and indirectly impact over 1,400 files. All the data is made available and the report comes with an interactive Web-based exploratory tool." The complexity exploration tool is pretty neat.

69 of 127 comments (clear)

  1. Does this guy know what Firefox is? by xxxJonBoyxxx · · Score: 4, Funny

    >> A number of modules, namely, accessible, browser and security, frequently appear among the most complex modules. Further investigation may be helpful in identifying why that is the case.

    Does this guy know what Firefox is?

    1. Re:Does this guy know what Firefox is? by CrimsonKnight13 · · Score: 2

      Maybe he's referring to the Mozilla codebase as a whole rather than just Firefox in itself?

      --
      Libera te ex Inferis!
    2. Re:Does this guy know what Firefox is? by Anonymous Coward · · Score: 2, Funny

      A virtual machine running an operating system that by accident happens to have a (rather mediocre) browser? Just like Chrome?

      All that was missing was the relabeling. I guess that's done with "FirefoxOS" and "ChromeOS". ;)

      Now all we need, is to port Linux to it. ... Oh wait!

    3. Re:Does this guy know what Firefox is? by game+kid · · Score: 2

      What is a Firefox? A miserable little pile of sources.

      But enough code... Have at you!

      --
      You can hold down the "B" button for continuous firing.
    4. Re:Does this guy know what Firefox is? by UltraZelda64 · · Score: 2

      What is a Firefox? A miserable little pile of sources.

      Really? I was under the impression that, traditionally, a Firefox was a miserable little pile of memory leaks. Although these days, that doesn't quite seem to be the case as much as it used to be.

    5. Re:Does this guy know what Firefox is? by UltraZelda64 · · Score: 1

      I got the joke. I was joking back, but apparently that wasn't caught by your detector.

      I was contemplating whether I should have added that second line or not. Do, and people will think I'm serious and not realize I'm just joking as well; Don't, and people will get offensive thinking I'm trolling and just slamming Firefox for the hell of it. But for stability these days, I figured credit is due, because I've slammed Mozilla/Firefox enough in the past.

    6. Re:Does this guy know what Firefox is? by Maxoverdrive · · Score: 1

      Too bad that doesn't work

  2. So? by ShanghaiBill · · Score: 5, Insightful

    It finds that 11% of files in Firefox are highly interconnected

    Figures like this would be more useful if they were put in context. What is a "normal" level for connectedness? What is the level for the Linux kernel, or for GCC? Compared to other similar sized projects, is 11% good or bad?

    1. Re:So? by hedwards · · Score: 4, Insightful

      Normal probably isn't so useful here, but it would give some context. 11% of files being highly interconnected could be a sign of incompetence on the part of the developers, or it could be a sign that they're engaged in sound design by splitting off commonly used methods into their own files and treating them as libraries.

      I'd suspect that the latter is the case here.

    2. Re:So? by Joce640k · · Score: 2

      It finds that 11% of files in Firefox are highly interconnected

      It means 89% aren't...which sounds much nicer.

      --
      No sig today...
    3. Re:So? by steelfood · · Score: 3, Informative

      It's crucial to know the distribution of that 11%. If they were all located in one area, it might be as you say, But if the 11% was comprised of a few files in each major module, then that'd be bad.

      You want the bulk of your program doing the actual work to look like a tree. You don't want the bulk of your program to look like a mesh (graph). This is especially true of your core components.

      --
      "If a nation expects to be ignorant and free in a state of civilization, it expects what never was and never will be."
    4. Re:So? by Anonymous Coward · · Score: 3, Insightful

      Not only that. The number is entirely meaningless, if we don't know *how* they are interconnected.

      If they are interconnected through a well-defined and stable interface, they can be connected as much as they want... it doesn't matter!

      What counts is the *modularity*! How much can you treat everything as independent modules? How much can you change the *implementation* without causing trouble.

      Because if they are cleanly separated that way, they are no different from being completely separate projects or programs.

      It's when things become "frameworks" that all the alarm bells go off.

    5. Re:So? by ArsonSmith · · Score: 2

      So, Nearly 90% of the Firefox code is of high quality and very maintainable.

      --
      Paying taxes to buy civilization is like paying a hooker to buy love.
    6. Re:So? by sootman · · Score: 1

      Good, obviously. It goes to 11!

      --
      Dear Slashdot: next time you want to mess with the site, add a rich-text editor for comments.
  3. Got a trojan warning by dasapfe · · Score: 5, Informative
  4. Re:Fork by hedwards · · Score: 4, Insightful

    You know that you don't have to load things in tabs if you don't want to, right? And I highly doubt that you're going to have any meaningful performance improvements by loading up different windows. Plugins are there for every browser and the worst offenders tend to be things like Flash which aren't always easily avoided. Extentions themselves aren't usually a problem if you don't install badly behaving ones. And many of them do actually help out with performance, noscript anybody?

  5. counting files today by Aighearach · · Score: 2

    and tomorrow we'll count the lines of code and spew more meh

  6. Re:Trojan warning by gandhi_2 · · Score: 1

    Considering that MSE takes even longer than Clam to identify new ANYTHINGS, I'm not sure how much stock I put in that report.

  7. I'm interested in seeing analysis of WebKit/Blink by 0x000000 · · Score: 4, Interesting

    I am wondering how this stacks up to a project like WebKit/Blink, as well as seeing that project against the original KHTML. Sure it is a renderer/HTML layout/JavaScript engine only, and won't contain the browser chrome like Firefox, but I think it would be interesting to look at.

    Many people have also suggested that WebKit is easier to embed into various different environments (more so than Gecko) and that it has been able to evolve faster mainly due to the code base being cleaner, and I wonder if this holds true when looking at it from a complexity standpoint, or is it more complex but simply laid out better and in a way that is easier to understand?

    --
    cat /dev/null > .signature
  8. Re:Fork by gstoddart · · Score: 1

    Plugins are there for every browser and the worst offenders tend to be things like Flash which aren't always easily avoided

    Except that Flash is easily avoided ... if you don't want Flash, don't install it, and don't use sites which require it.

    You might decide that there's stuff you can't live without, and I definitely agree that in company environments it can be damned near impossible as it seems there's usually one or two things you need which requires it.

    But if you decide you don't want it and won't use it, it's actually not difficult at all to avoid. I've been doing it for over a decade, and it hasn't been on any of my own machines. My work machines, I've never been able to avoid having it, but only in IE which is the browser of last resort for those company things you have to visit a few times each year (like the ethics training courses we all know and love).

    You just have to decide that not having it is worth more than the sites which need it, and there hasn't been a single site which made we think "OK, for this I'll install Flash".

    --
    Lost at C:>. Found at C.
  9. No Script sucks because the net sucks by Anonymous Coward · · Score: 1, Insightful

    OK let's start with:

    noscript anybody?

    I loaded it. And every single website I use - like my library, credit union, broker, SLASHDOT, Amazon, etc ... will not work correctly without their scripts running. I can't even login without having to "Allow all scripts''

    Why "Allow all..." because, every goddamn website calls a myriad of different other websites for god knows what the fuck they're doing.

    I TRIED to selectively whitelist websites and all I got was half functional shit- and not being able to access my account many times.

    I mean really Web "Engineers" - WTF?!?!

    It seems that every one of you point call asshole like google analytics and other advertizing shitholes.

    And this social media shit. I mean really, do you have to have those stupid fucking buttons for Facebook, Google+, and every other narcissistic fucking web site out there?!?

    Hey kids! Wanna get rich quick!?

    Start your own business that caters to societies insatiable need for narcissism: See Apple, Harley Davidson, every luxury car or product maker out there, Facebook, Google+, every goddamn reality show, people registered on Slashdot, the real loosers who are registers under their Google+ or Facebook accounts, ....

    Appeal to people's vanity and get rich.

    At least the Christian myth about Satan is correct: people are suckers for the 7 deadly sins.That's how to get rich! Follow Satan!

    See every TV preacher that has ever existed

    1. Re:No Script sucks because the net sucks by liamevo · · Score: 2

      Don't blame us, blame the marketers and SEO people.

    2. Re:No Script sucks because the net sucks by Garridan · · Score: 1

      No you don't need to allow all ever. I allow all for my school's domain, and nothing else. Those social media buttons don't even show up for me on most pages 'cause they use a third-party javascript loader. On the very rare occasion that I can't get a site to work, I switch to private mode (ctrl-shift-p) and allow all there. I like to use half-broken websites. I break the half that tracks me / loads cpu-intensive flash ads / makes the page take 10 seconds to load. If they still manage to annoy me, up comes firebug and *whoops*! There go the page elements I didn't like. Grayed-out content? I think not!

    3. Re:No Script sucks because the net sucks by LordLimecat · · Score: 1

      You could just install ghostery, which generally JustWorks (TM).

  10. LibXUL on Win32 approaching 4GB memory limit by revealingheart · · Score: 5, Informative

    According to recent comments (continued on the next day's thread), the win32 compiler that Mozilla use is approaching the 4GB limit, after which LibXUL (which Firefox depends upon) will no longer compile.

    It's currently at 3.5GB, and at the current rate, will reach the limit in approximately 6 months: Chart of memory usage of LibXUL during last 90 days

    While I think that Servo will produce a more decentralised design than Gecko and XUL, the memory limit will be reached well before that. With Windows XP support ending next year, Mozilla should consider migrating to x64 as soon as reasonably possible, keeping x32, but focusing on stripping large and extraneous code above new features.

    1. Re:LibXUL on Win32 approaching 4GB memory limit by TheRealMindChild · · Score: 1

      Sounds like a good point to refactor

      --

      "When life gives you lemons, don't make lemonade. Make life take the lemons back!" -- Cave Johnson
    2. Re:LibXUL on Win32 approaching 4GB memory limit by InvisiBill · · Score: 2

      Reminds me of http://developers.slashdot.org/story/11/12/14/1725205/firefox-too-big-to-link-on-32-bit-windows... As one commenter in that thread asked, haven't they switched to x64 compilers yet? (Apparently there are issues getting the x86 version to compile properly on x64.)

    3. Re:LibXUL on Win32 approaching 4GB memory limit by BitZtream · · Score: 2

      Switching a few command line options to the compiler would completely resolve the issue. The downside is that it'll take longer to compile.

      Realistically though, if your hitting those limits, the compiler isn't the problem, the code is.

      Bloat much?

      --
      Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
    4. Re:LibXUL on Win32 approaching 4GB memory limit by TheDarkMaster · · Score: 2

      I think something is seriously wrong when a program becomes too large to be compiled.

      --
      Religion: The greatest weapon of mass destruction of all time
    5. Re:LibXUL on Win32 approaching 4GB memory limit by jones_supa · · Score: 1

      I don't get it. Couldn't you just use a 64-bit compiler and set it to produce 32-bit binaries?

    6. Re:LibXUL on Win32 approaching 4GB memory limit by HoserHead · · Score: 5, Informative

      I'm a Firefox developer.

      This is slightly inaccurate. We aren't running out of memory to link Firefox, we're running out of memory to run Profile-Guided Optimization (PGO) on Firefox.

      PGO looks at what is actually executed during a given workload and optimizes based on that. It can be a pretty big win — 30% in some workloads —so we work pretty hard to keep it going.

      Unfortunately, PGO needs to have not only all the code, but all the intermediate representations and other metadata about the code in memory at one time. (That's why we're running out of memory.)

      Unfortunately, MSVC doesn't support producing a 32-bit binary using their 64-bit compiler.

      (FWIW, Chrome has *always* been too big to use PGO.)

    7. Re:LibXUL on Win32 approaching 4GB memory limit by Anonymous Coward · · Score: 1

      to be linked not compiled... if you use link time optimization, the memory usage grows fast

    8. Re:LibXUL on Win32 approaching 4GB memory limit by coolsnowmen · · Score: 2

      It has to do with the compiler optimizations that profile code more than it has to do with code bloat.

    9. Re:LibXUL on Win32 approaching 4GB memory limit by Eravnrekaree · · Score: 1

      Its the optimization phase that takes up a lot of RAM. Id rather they skip the optimization phase rather than damage features and functionality. If firefox wont render pages well, i would give up on it.

    10. Re:LibXUL on Win32 approaching 4GB memory limit by Eravnrekaree · · Score: 1

      Why not switch to compiling it with something that can cross compile, running the compiler on 64 bits. Perhaps GCC or Clang could do the job?

    11. Re:LibXUL on Win32 approaching 4GB memory limit by Xest · · Score: 1

      "(FWIW, Chrome has *always* been too big to use PGO.)"

      Chrome is also more performant too though, so what do they do instead? Is it simply better architected from the outset?

    12. Re:LibXUL on Win32 approaching 4GB memory limit by HoserHead · · Score: 1

      Actually, the problem on Linux is also PGO.

  11. Um, you forgot to go AC when you trolled. by Gordo_1 · · Score: 3, Informative

    Really? The version number thing again? Hasn't that been played out yet? Incidentally, 3.0 is not even close to when they moved to a rapid release cycle.

    1. Re:Um, you forgot to go AC when you trolled. by NotBorg · · Score: 3, Insightful

      Hasn't that been played out yet?

      Nope. Trolls echo forever.

      --
      I want this account deleted.
  12. Lots of pretty numbers... by DrStrangluv · · Score: 3, Insightful

    ... that have no meaning at all.

    Impacting 8 files on average would be horrible... for a project with 8 files. But how many is that relative to the size of Firefox?

    11% of files in Firefox are highly interconnected... but how does that compare to other projects of similar scope?

    The one value in that summary that had any meaning at all was the comment that the percentage of interconnected files "went up significantly following version 3.0". That at least has some relative measure we can use as a base.

    1. Re:Lots of pretty numbers... by wonkey_monkey · · Score: 2

      I'm also wondering what "impact" means here. "Indirectly impact" doubly so.

      --
      systemd is Roko's Basilisk.
    2. Re:Lots of pretty numbers... by ArsonSmith · · Score: 3, Funny

      I'm not an expert and of course wouldn't read the TFA but from reading the headline and a good part of the summary, I've deduced that "impact"="bad" and "Indirectly impact"="scary bad".

      Hope that helps.

      --
      Paying taxes to buy civilization is like paying a hooker to buy love.
  13. Re:Fork by Garridan · · Score: 1

    You missed the obvious FireFork.

  14. Re:"Went up significantly following version 3.0" by NotBorg · · Score: 1
    FTA:

    4.2 Switching to the rapid release cycle (RRC) has had a positive impact on maintainability

    "Crazy" seems to be working just fine.

    --
    I want this account deleted.
  15. Re:"Went up significantly following version 3.0" by Anonymous Coward · · Score: 1

    Version 3, version 4 - what's the difference? So he was off by 20 minutes. Big deal.

  16. The code base was not designed for concurrency by Animats · · Score: 4, Informative

    It's a real problem. The Firefox dev team gave up on running add-ons in a separate process (the "electrolysis" project) because the code base was too single-thread oriented. Remember, some of the code dates back to Netscape. There's talk of reviving that project now, but it's mostly talk and meetings.)

    Refitting concurrency tends to be very hard and the result tends to be ugly. You get something like Windows 3.x or MacOS 6/7, where easy things are complicated for the wrong reasons.

    1. Re:The code base was not designed for concurrency by bill_mcgonigle · · Score: 2

      There are clearly people working on Mozilla who 'get it', but the project management seems adverse to tackling anything long-term or difficult. They also like to officially deny that real problems exist. Just as a random sample of tech geeks, how long were people here bitching about Firefox memory usage while we were fed a line of excuses. I recall reading the blog of the lone dev who started what came to be known as the Memshrink project, which, when it was done, management loved to tout, but before that "didn't matter".

      The bz on multithreading the browser has been open for, what, 12 years? As of 2011, it wasn't a problem anymore. "ooh, mobile, new shiny!"

      This is one area where Chrome runs circles around Firefox. Their tech people get to work on things they think are valuable and management supports them. They take on hard projects (i.e. forking WebKit). If anything, it should be the private non-profit that can take these risks!

      So, guess which browser is an irrelevant pig dog on my 2-year-old smartphone...

      --
      My God, it's Full of Source!
      OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
    2. Re:The code base was not designed for concurrency by Anonymous Coward · · Score: 1

      FYI, Electrolysis is back on.

      https://wiki.mozilla.org/Electrolysis#Yes_these_dates_are_real_and_from_2013.21

    3. Re:The code base was not designed for concurrency by bluegutang · · Score: 1

      The Firefox dev team gave up on running add-ons in a separate process (the "electrolysis" project) because the code base was too single-thread oriented. Remember, some of the code dates back to Netscape

      I thought the conventional wisdom was that the Mozilla team made a mistake, unnecessarily losing time, by starting over from scratch. In other words there is not enough Netscape code in Firefox!

  17. Re:Is anyone still using it? by Anonymous Coward · · Score: 1

    Bullshit. If it were irrelevant you wouldn't have clicked on every last FF article to profess its irrelevance. The truth is that it's so relevant that you feel threatened enough by it to leave your mark everywhere.

    P.S. You forgot to tick "Anonymous Coward"

  18. Re:Is anyone still using it? by Mike+Frett · · Score: 1

    Oh please, even on a super computer the Firefox UI is as slow as Molasses. I can say that since I use Firefox everyday as my main browser. Why should I stick up for something that I know has issues. He wasn't even talking about RAM, he was speaking of lightness, like Midori for instance; Firefox use to be lean and mean like Midori.

    I haven't personally looked into it, but I'd be highly interested in a Fork that brings it back to what it use to be. I can't find any information, but for Linux, as of last year the 3x branch of Firefox was still being updated; but don't quote me on that.

  19. Largely Irrelevant by Jane+Q.+Public · · Score: 1

    There are lots of measures of a code's "maintainability", with interconnectedness being just one of them.

    More to the point, that's what code tests are for: to make sure changing one thing doesn't break another. Talking about the "health" of the code base without knowing about test coverage or effectiveness is pretty damned meaningless, regardless of "interconnectedness". My view is that Ali Almossawi's paper is therefore a waste of dead trees.

  20. Those who ignore History... by theatreman · · Score: 1

    Oh the history - the netscape codebase being so complex a complete re-write was necessary...

    1. Re:Those who ignore History... by triffid_98 · · Score: 1

      Quite correct. After 4.7 (circa IE5) they chucked it and Mozilla was born after several more years of re-development.

      I've no idea how bad the old code base was but I'd imagine based on past experience they would have done a cleaner job this time around.

    2. Re:Those who ignore History... by jensend · · Score: 1

      Well, things would be cleaner to re-implement this time around if they had to do another rewrite, because cross-platform development is now a basically solved problem.

      In 1998, getting one codebase that would work on things like various ancient Unices, "DOS-based" Windows (95/98/Me), and Mac OS 8/9 was a very difficult task. Beyond the lower-level concerns, few good libraries would work across all targets. C++ itself was a mess when trying to work across different systems and compilers- many things could not be counted on to work everywhere until some years after the first C++ standardization in 1998.

      So Mozilla wrote their own 'toolkit' (kinda) and portability/compatibility stuff, their own code that did much of what the C++ standard library really ought to do, and a lot of other stuff.

      With modern operating systems, modern cross-platform libraries, universal C++03 support and widespread support for most of C++11, a rewrite would be a very different story today.

    3. Re:Those who ignore History... by Eravnrekaree · · Score: 1

      Was that really why a new browser architecture was created. It may have been simply due to the fact the old rendering engine did not structurally support document reflow well, without creating a huge second systems effect anyway, which would lead to obfuscation problems. The old rendering engine may have been fine for what it was designed to do.

  21. Re:Is anyone still using it? by amorsen · · Score: 1

    The main complaint about Firefox, right from the start, has been memory leaks. You are rewriting history, Firefox was never lean and mean.

    If anything Firefox is like Emacs in that the median power of computers is increasing faster than the resource consumption.

    --
    Finally! A year of moderation! Ready for 2019?
  22. Re: Is anyone still using it? by Anonymous Coward · · Score: 1

    GG Firefox! http://caniuse.com/mathml

  23. Re:Fork by jones_supa · · Score: 1

    Of course you need Flash. Even YouTube is not able to offer all videos in HTML5 format.

  24. Re:Who cares? by jones_supa · · Score: 1

    Use the Extended Support Release of Firefox.

  25. RTFA by Anonymous Coward · · Score: 1

    The conclusions of the research are very positive and shed a very good light on the health of the code. Why is everyone commenting like the conclusions are the opposite?

  26. Re:Fork by jones_supa · · Score: 1

    Who cares about random cat videos? I watch maybe 5 YouTube videos a year.

    There is really good stuff in YouTube these days. Not just cat videos or dogs on skateboards.

    How about bigthink or EEVblog, for example?

  27. Re:I'm interested in seeing analysis of WebKit/Bli by Eravnrekaree · · Score: 1

    Webkit may be better documented. I tried to find documentation on Gecko and it was very limited, I gave up on it.

  28. Re:Is anyone still using it? by Eravnrekaree · · Score: 1

    Firefox isnt meant to be a super lightweight browser but one that can render anything. A lightweight browser would be an unuseable browser for normal people. If you want a lightweight browser try Dillo. The UI code and the rendering code probably consumes very little at runtime compared to all of the image data that is being stored in memory, anyway.

  29. How maintainable? by Trogre · · Score: 1

    Well if the fate of Camino with Gecko is anything to go by: not very.

    --
    "Nine times out of ten, starting a fire is not the best way to solve the problem." - my wife
  30. Re:Who cares? by TheSeatOfMyPants · · Score: 1

    I ended up switching to Opera after retrying it a few months ago-- it has a whole slew of formerly Firefox-only extensions now (like AdBlock Plus, Stylish, Greasemonkey, LastPass, etc.), I haven't run across any site incompatibilities yet, and it's a hell of a lot faster than Firefox was running for me.

    --
    Now mostly at Usenet:comp.misc & SoylentNews.org (it's made of people!)
  31. Re:Hah by AnalogBrain · · Score: 1

    First sentence on Wikipedia:
    In mathematics, a directed graph or digraph is a graph...
    http://en.wikipedia.org/wiki/Directed_graph

  32. Re:Who cares? by angel'o'sphere · · Score: 1

    Interesting link, thanks!

    --
    Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  33. Re:Fork by jones_supa · · Score: 1

    Ok. I understand then.