# What in Julia is done in C?

**URL:** https://discourse.julialang.org/t/what-in-julia-is-done-in-c/90661
**Category:** New to Julia
**Created:** [November 22, 2022, 6:28pm UTC](https://discourse.julialang.org/t/what-in-julia-is-done-in-c/90661 "2022-11-22T18:28:07Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![nvenkov1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nvenkov1/32/43679_2.png) [@nvenkov1](https://discourse.julialang.org/u/nvenkov1)
#### Post date: [November 22, 2022, 6:28pm UTC](https://discourse.julialang.org/t/what-in-julia-is-done-in-c/90661/1 "2022-11-22T18:28:07Z")

</div>

I know that a force of Julia is that it is high level and yet, you can code low level routines natively in Julia and still obtain good performances, whereas in Python, you would be advised to bind and wrap C or Fortran code to obtain similar performances. At the same time, I hear and read that Julia is mostly written in C. However, what I do not understand is what is natively written in Julia and what is not, i.e., what is written in C? For example, say linear algebraic operations. In Python, every operation between NumPy arrays is actually coded in C, I think the same goes for Matlab, what about in Julia, does a matrix-vector product run C code or not?

---

<div class="post-metadata">

### Author: ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)
#### Post date: [November 22, 2022, 6:36pm UTC](https://discourse.julialang.org/t/what-in-julia-is-done-in-c/90661/2 "2022-11-22T18:36:38Z")

</div>

> [@nvenkov1](#):
>
> At the same time, I hear and read that Julia is mostly written in C.

Where do you get that information? Here’s the Julia language repository breakdown from [GitHub](https://github.com/JuliaLang/julia):

![image](https://global.discourse-cdn.com/julialang/original/3X/2/2/22e64388e77003cb99b80cd7da3fe76d25b63eee.png)

The C part is largely very low-level internals like garbage collection and codegen (interfacing with LLVM; a C++ project).

---

<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: [November 22, 2022, 6:40pm UTC](https://discourse.julialang.org/t/what-in-julia-is-done-in-c/90661/3 "2022-11-22T18:40:58Z")

</div>

Much of the Julia standard library is written in Julia itself, e.g. even things as basic as [complex number arithmetic](https://github.com/JuliaLang/julia/blob/7262534ff650dac0a03d995712ead228f8225bfc/base/complex.jl) or fancier things like [sparse matrix–vector multiplies](https://github.com/JuliaSparse/SparseArrays.jl/blob/710fd7ba7184b062ca85e655e4b11928f6cc715d/src/linalg.jl#L816-L856) and [`printf` formatting](https://github.com/JuliaLang/julia/blob/7262534ff650dac0a03d995712ead228f8225bfc/stdlib/Printf/src/Printf.jl)

However, of course there have been decades of engineering effort poured into mature libraries, and we want to exploit those where possible. So, Julia uses pre-existing libraries (mostly in C and Fortran) for things like:

- [LAPACK](https://en.wikipedia.org/wiki/LAPACK)/[BLAS](https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms) linear algebra (e.g. matrix inversion, matrix–matrix multiplies). However, it also has native Julia versions of most of this functionality, which is useful for linear algebra on new number types (whether bignums, quaternions, finite fields, …). And people have also demonstrated that [optimized native Julia BLAS operations](https://github.com/JuliaLinearAlgebra/Octavian.jl) can match the performance of heavily optimized BLAS libraries like MKL or OpenBLAS.
- Regular expressions, using the [PCRE library](https://www.pcre.org/).
- Downloading files, via [libcurl](https://curl.se/libcurl/). (But there is also a [native-Julia HTTP library](https://github.com/JuliaWeb/HTTP.jl).)
- Low-level asynchronous IO, via [libuv](https://libuv.org/).
- Native compilation, via [LLVM](https://llvm.org/). (But higher-level compiler passes like type inference are [largely implemented in Julia](https://github.com/JuliaLang/julia/tree/master/base/compiler).)
- Bignum arithmetic, via [GMP](https://gmplib.org/) and [MPFR](https://gmplib.org/). (But there are also native-Julia [extended-precision arithmetic types](https://github.com/JuliaMath/DoubleFloats.jl).)

This is not because such things _cannot_ be implemented in Julia, but more because we are mainly interested in using Julia to implement _new functionality_ rather than simply re-inventing the wheel by replicating mature existing code.

---

<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: [November 22, 2022, 6:42pm UTC](https://discourse.julialang.org/t/what-in-julia-is-done-in-c/90661/4 "2022-11-22T18:42:55Z")

</div>

> [@mbauman](#):
>
> Here’s the Julia language repository breakdown from [GitHub](https://github.com/JuliaLang/julia):

(It depends on how you count. It’s true that the Julia implementation required little _new_ C/C++ code.  
However, we of course also utilize existing libraries as mentioned above, and these aren’t included in the github stats because [deps/Makefile](https://github.com/JuliaLang/julia/blob/7262534ff650dac0a03d995712ead228f8225bfc/deps/Makefile) downloads a bunch of external libraries at build time.)
