# Run the half-life of code analysis on Julia?

**URL:** https://discourse.julialang.org/t/run-the-half-life-of-code-analysis-on-julia/763
**Category:** Community
**Tags:** history
**Created:** [December 6, 2016, 2:46pm UTC](https://discourse.julialang.org/t/run-the-half-life-of-code-analysis-on-julia/763 "2016-12-06T14:46:04Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)
#### Post date: [December 6, 2016, 2:46pm UTC](https://discourse.julialang.org/t/run-the-half-life-of-code-analysis-on-julia/763/1 "2016-12-06T14:46:04Z")

</div>

Not quite a language development post (so maybe it will get recategorized), but it would be interesting to see the results of this “half-life of code” analysis on Julia’s git repo:

> **[The half-life of code & the ship of Theseus](https://erikbern.com/2016/12/05/the-half-life-of-code.html)**
>
> As a project evolves, does the new code just add on top of the old code? Or does it replace the old code slowly over time? In order to understand this, I built a little thing to analyze Git projects, with help from the formidable GitPython project.

I thought the results would be interesting, but realistically I won’t get around to it so I figured I’d throw it out here and see if anyone wants to take a crack at it.

---

<div class="post-metadata">

### Author: ![cdsousa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cdsousa/32/215553_2.png) [@cdsousa](https://discourse.julialang.org/u/cdsousa)
#### Post date: [December 7, 2016, 12:00am UTC](https://discourse.julialang.org/t/run-the-half-life-of-code-analysis-on-julia/763/2 "2016-12-07T00:00:40Z")

</div>

Here it goes,

 ![](https://global.discourse-cdn.com/julialang/original/3X/b/7/b795daba6296b88e53d0464b02688b731ff0ff1d.png)  
 ![](https://global.discourse-cdn.com/julialang/original/3X/b/0/b06325f696498c7d53a3f9e7648d7f91bc23398f.png)

---

<div class="post-metadata">

### Author: ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)
#### Post date: [December 7, 2016, 8:43pm UTC](https://discourse.julialang.org/t/run-the-half-life-of-code-analysis-on-julia/763/3 "2016-12-07T20:43:00Z")

</div>

It would be great to get some insider explanations on the upper graph.

A few outsider observations:

- code of 2011 has almost all perished whereas that of 2010 has not.
- what’s that huge spike in 2012?
- LOCs was around 50,000 in 2013 and 2014, then doubled in 2015.
- Feb 2012: Julia announced, afterwards LOCs increase sharply.
- Feb 2013: 0.1 released: this is around the end of those big drops in LOCs after the huge spike
- Aug 2014: 0.3 released, before quite a big drop.
- Now: the imminent merge of [#18588](https://github.com/JuliaLang/julia/pull/18588) would produce a visible dent of -20,000 LOCs.

---

<div class="post-metadata">

### Author: ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)
#### Post date: [December 8, 2016, 3:08am UTC](https://discourse.julialang.org/t/run-the-half-life-of-code-analysis-on-julia/763/4 "2016-12-08T03:08:10Z")

</div>

These are all guesses, but here are some plausible answers:

> - code of 2011 has almost all perished whereas that of 2010 has not.

In 2010 the code was mostly really basic things that you need to bootstrap a language – parsing, core C runtime functionality, how to do arithmetic on integers and floats, etc. – there’s not much reason to change these once they work. By 2011, we were building out an initial cut of a standard library which is more malleable and definitely doesn’t have one “right” answer. So I’m guessing most of the initial stdlib code has been replaced over time. By the same sort of thinking, 2009 was pretty much just “sketching” and prototyping, so almost all of that code was replaced pretty quickly.

The mini spike in 2011 was @viralbshah checking in the source of msun (and a bunch of HTML pages where wget had gotten a 404 or something 😬). That was on August 8th and then after some work getting it into shape and working, he [moved](https://github.com/JuliaLang/julia/commit/fe4f2cad317dbef3bd4a3e7b5e829668c5b58eaf) the whole thing into a separate repo as OpenLibm on August 13th.

> - what’s that huge spike in 2012?
> - Feb 2012: Julia announced, afterwards LOCs increase sharply.
> - Feb 2013: 0.1 released: this is around the end of those big drops in LOCs after the huge spike

Back then we didn’t have packages, so there was a bunch of additional package-like code checked in the JuliaLang/julia repo under the `extras` directory:

- editor support
- plotting (Winston)
- bindings to graphics libraries (Cairo)
- data structures (trie)
- color support
- GLPK
- image formats (DICOM, FITS)
- ode solvers
- Rmath (that one took a while to get rid of!)
- polynomials
- a web server!
- linear programming
- statistical distributions
- HDFS support
- memoization
- zlib support
- Tk support
- argument parsing
- WAV file support
- ICU library bindings
- JSON parsing
- units
- text wrapping

This was getting pretty out of control, so I wrote a package manager and [on Nov 20th](https://github.com/JuliaLang/julia/commit/1702ad14a6e75b321c0de40704a23cfa698ee307) deleted a ton of stuff that had been moved into packages. We kept on moving things into packages so that by Julia 0.1 most of this lovely menagerie of stuff was no longer in Base Julia.

Somewhere in that same time period, Mike Nolta [moved the manual](https://github.com/JuliaLang/julia/commit/403b0d1e7b164236301d28f5684622bf39b996e8) from the [JuliaLang.org](http://JuliaLang.org) website to the julia repo as well. Interestingly enough, this move was from Markdown hosted on GitHub to RestructuredText hosted on Read The Docs, which is the exact inverse of what we just did today.

> - LOCs was around 50,000 in 2013 and 2014, then doubled in 2015.

I suspect a lot of this is increased test coverage and lots more documentation. Overall the growth in LOC looks roughly linear. I’d be interested in seeing this analysis broken down in `src`, `base`, `doc`, etc.

> - Aug 2014: 0.3 released, before quite a big drop.

Not sure what this is. Maybe some other chunk of functionality that we moved out? Anyone remember? I don’t see anything in the release notes that jogs my memory.

> - Now: the imminent merge of #18588 would produce a visible dent of -20,000 LOCs.

That’s the way @jeff.bezanson rolls – his net LOC contribution to the project is negative 😁. #18588 is the best kind of change: it adds functionality, generalizes things, removes tons of code.

Anyone know what the spike in early 2016 is? Looking through the git log, I don’t see anything obvious.

---

<div class="post-metadata">

### Author: ![kevin.squire](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevin.squire/32/62_2.png) [@kevin.squire](https://discourse.julialang.org/u/kevin.squire)
#### Post date: [December 8, 2016, 9:15pm UTC](https://discourse.julialang.org/t/run-the-half-life-of-code-analysis-on-julia/763/5 "2016-12-08T21:15:57Z")

</div>

> > Now: the imminent merge of #18588 would produce a visible dent of -20,000 LOCs.

> That’s the way @jeff.bezanson rolls – his net LOC contribution to the project is negative 😁. #18588 is the best kind of change: it adds functionality, generalizes things, removes tons of code.

> Anyone know what the spike in early 2016 is? Looking through the git log, I don’t see anything obvious.

Actually, [#18588](https://github.com/JuliaLang/julia/pull/18588) is Michael Hatherly’s Manual conversion.

Presumably you were thinking of [#18457](https://github.com/JuliaLang/julia/pull/18457), which has a net gain of ~600 lines so far… although you’re right that he has a [net negative LOC](https://github.com/JuliaLang/julia/graphs/contributors). 😉

---

<div class="post-metadata">

### Author: ![simonbyrne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simonbyrne/32/19_2.png) [@simonbyrne](https://discourse.julialang.org/u/simonbyrne)
#### Post date: [December 8, 2016, 9:36pm UTC](https://discourse.julialang.org/t/run-the-half-life-of-code-analysis-on-julia/763/6 "2016-12-08T21:36:37Z")

</div>

> [@StefanKarpinski](#):
>
> That’s the way @jeff.bezanson rolls – his net LOC contribution to the project is negative

That’s actually true for the [top 3 contributors](https://github.com/JuliaLang/julia/graphs/contributors)

---

<div class="post-metadata">

### Author: ![JeffreySarnoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreysarnoff/32/1980_2.png) [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)
#### Post date: [December 8, 2016, 11:30pm UTC](https://discourse.julialang.org/t/run-the-half-life-of-code-analysis-on-julia/763/7 "2016-12-08T23:30:55Z")

</div>

Most impressive … in order of appearance there, who is a takes away more lines of code than they leave?

JeffBezanson, StephanKarpinski, ViralBShah, MichaelHatherly, pao, carnaval, avkis, jcorbin, KDr2, zhmz90

---

<div class="post-metadata">

### Author: ![Tero\_Frondelius](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tero_frondelius/32/7629_2.png) [@Tero\_Frondelius](https://discourse.julialang.org/u/Tero_Frondelius)
#### Post date: [December 10, 2016, 10:35pm UTC](https://discourse.julialang.org/t/run-the-half-life-of-code-analysis-on-julia/763/8 "2016-12-10T22:35:49Z")

</div>

> [@StefanKarpinski](#):
>
> I’d be interested in seeing this analysis broken down in src, base, doc, etc.

```bash
$> python git-of-theseus/analyze.py julia --outdir "julia_test" --only "test/*"
$> cd julia_test
$> python ../git-of-theseus/stack_plot.py cohorts.json
$> python ../git-of-theseus/survival_plot.py survival.json

```

 ![](https://global.discourse-cdn.com/julialang/original/3X/3/7/372ec2af7e3ca3d81694c0bc30fa71a1da2cbbd4.png)

 ![](https://global.discourse-cdn.com/julialang/original/3X/2/7/27a2d9b10be3b947d08a867b45c39d4fa41f23e9.png)

---

<div class="post-metadata">

### Author: ![Tero\_Frondelius](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tero_frondelius/32/7629_2.png) [@Tero\_Frondelius](https://discourse.julialang.org/u/Tero_Frondelius)
#### Post date: [December 10, 2016, 10:36pm UTC](https://discourse.julialang.org/t/run-the-half-life-of-code-analysis-on-julia/763/9 "2016-12-10T22:36:05Z")

</div>

> [@StefanKarpinski](#):
>
> I’d be interested in seeing this analysis broken down in src, base, doc, etc.

```bash
$> python git-of-theseus/analyze.py julia --outdir "julia_doc" --only "doc/*"

```

 ![](https://global.discourse-cdn.com/julialang/original/3X/0/0/006df2f6ac5e9fc9a286f360930f0a8aaddfdde0.png)

 ![](https://global.discourse-cdn.com/julialang/original/3X/7/b/7bafc241c2096834f946aafe2f0b20dcef62a714.png)

---

<div class="post-metadata">

### Author: ![Tero\_Frondelius](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tero_frondelius/32/7629_2.png) [@Tero\_Frondelius](https://discourse.julialang.org/u/Tero_Frondelius)
#### Post date: [December 11, 2016, 7:49am UTC](https://discourse.julialang.org/t/run-the-half-life-of-code-analysis-on-julia/763/10 "2016-12-11T07:49:36Z")

</div>

> [@StefanKarpinski](#):
>
> I’d be interested in seeing this analysis broken down in src, base, doc, etc.

```bash
$> python git-of-theseus/analyze.py julia --outdir "julia_src" --only "src/*"

```

 ![](https://global.discourse-cdn.com/julialang/original/3X/5/b/5b28083e0f870b63d7e9e828b2c75e7aacd96ff4.png)

 ![](https://global.discourse-cdn.com/julialang/original/3X/5/d/5dfef82c4896b426e0dd141d561e6ca07ffd8ead.png)

---

<div class="post-metadata">

### Author: ![Tero\_Frondelius](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tero_frondelius/32/7629_2.png) [@Tero\_Frondelius](https://discourse.julialang.org/u/Tero_Frondelius)
#### Post date: [December 11, 2016, 8:01am UTC](https://discourse.julialang.org/t/run-the-half-life-of-code-analysis-on-julia/763/11 "2016-12-11T08:01:37Z")

</div>

> [@StefanKarpinski](#):
>
> I’d be interested in seeing this analysis broken down in src, base, doc, etc.

```bash
$> python git-of-theseus/analyze.py julia --outdir "julia_base" --only "base/*"

```

 ![](https://global.discourse-cdn.com/julialang/original/3X/d/c/dc76cb7b8032dae8966bc3df493a69bbd073ecc2.png)

 ![](https://global.discourse-cdn.com/julialang/original/3X/f/8/f80d114dc35310063b92e50f17ca5ab20e7e0e3b.png)

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [July 25, 2022, 7:22pm UTC](https://discourse.julialang.org/t/run-the-half-life-of-code-analysis-on-julia/763/12 "2022-07-25T19:22:28Z")

</div>

In honor of JuliaCon 2022 I thought I’d resurrect this old thread with some updated results. In particular, you can see several big deletions after 2016 and 2018, probably where code was moved out into packages.

 ![cohorts](https://global.discourse-cdn.com/julialang/original/3X/6/d/6d8d5c634c38ed1bcc53815c3046099195a10fd7.png)

Not surprisingly, after the core code was written in C, C++, and Scheme, most of the new `julia` code has been in Julia (`.jl`) files (originally `.j` files):

 ![exts](https://global.discourse-cdn.com/julialang/original/3X/f/2/f232b77321d76e0c4688948cfdc2327bb3bd26ce.png)

(You can also see the moment when the documentation migrated away [from rst to markdown](https://github.com/JuliaLang/julia/issues/12573), though `.rst` is shown but not `.md` files.)
