# Porting a CAS to Julia

**URL:** <https://discourse.julialang.org/t/porting-a-cas-to-julia/9924>\
**Category:** General Usage\
**Created:** [March 20, 2018, 5:01pm UTC](https://discourse.julialang.org/t/porting-a-cas-to-julia/9924 "2018-03-20T17:01:21Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![Jean\_Michel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jean_michel/32/8282_2.png) [@Jean\_Michel](https://discourse.julialang.org/u/Jean_Michel)\
**Post date:** [March 23, 2018, 3:42pm UTC](https://discourse.julialang.org/t/porting-a-cas-to-julia/9924/10 "2018-03-23T15:42:14Z")

</div>

> [@Eye in julia 0.7](https://discourse.julialang.org/t/eye-in-julia-0-7/9820/42):
>
> Understanding this stuff is really the key to getting good performance in Julia. And you really need to understand this before you port a large computer-algebra system to Julia, as otherwise the design will be all wrong.

I completely agree with this which is why I am happy to discuss such questions with you. But: I think I understand now everything in your post. However, do _you_ understand why `BigInt` are very slow  
in Julia compared to the integers of other languages like Python, Ruby or Gap where all integers are “Big”  
(I found instances where they are 50 times slower, see [[A plea for int overflow checking as the default - #46 by Olof\_Salberger](https://discourse.julialang.org/t/a-plea-for-int-overflow-checking-as-the-default/3338/46)])?  
The reason is that their type `BigInt` is a union of a BitsType Int and a Boxed type BigInt with automatic switch from one to the other depending when overflow or when the BigInt becomes small enough to be converted.  
I hoped you were going to explain how to achieve this in Julia.

Similarly, I think a `Union{Int, Rational{Int}}` where `Rationals` with denominator 1 would be automatically converted to integers could be faster than `Rationals`

---

_[View the full topic](https://discourse.julialang.org/t/porting-a-cas-to-julia/9924)._
