Python/Django Vs. Rust

First off -- this is the first blog post, woohoo! I figured I would start with a fundamental question which is: what software is best to meet the business logic you need to automate your worst business tasks?

Django and Rust, probably neither one of those words means too much to you unless you have a technical background, but no time like the present to learn!

Django is a web framework built in the Python programming language. A web framework you can think of as a standard toolkit a contractor might have. It would take 10 years to build a house from scratch with no tools, but with some heavy machinery, it can get done in a couple weeks. Django is a powerful set of tools in Python that lets you build systems very fast.

It was built originally by the programmers at the Lawrence Journal-World newspaper, and has been widely adopted not only by most media firms, but by many other kinds of small businesses.

Here's a fancy tidbit you might not know about working in media -- the average web page of content produced by a media firm has the fastest attrition rate, by far, compared to all other kinds of web pages. That is to say, your blog article about cooking may only get 2 - 4 % of the lifetime of its views in the first day after publishing, the average media article gets 98% of its views within the first 3 days of publishing, and on average around 60 - 80% of its views on the first day.

Django is built to be rapid by necessity. While working in media, if a new system needs to be built to accommodate a breaking news situation -- you see it all the time, for example, when a news website needs to create a storm tracking app, or more recently tracking COVID -- it needs to be built fast and reliably.

Since there is no sense reinventing the wheel, Django was born. It has spread rapidly and become the dominant framework of many Media companies due to its ability to produce fast, reliable systems on a moment's notice.

That translates to two things: First, a big cost savings. If it takes 10 hours instead of 100 hours to build the software you need, it takes 1/10th the time for a developer, and costs 1/10th the labor to produce.

And secondly, because of the time sensitive nature of Media, (but let's be real here, all businesses are locked in competition and rapid product development hurts no one) getting web applications up faster than competitors gives you an edge to be the best of breed. E.g. if CNN can produce a better election tracker than MSNBC, they will get the bigger share of people monitoring election polls, and that translates directly to more ad revenue.

Wow, you're probably saying, why would anyone need anything BUT Django with all those features?

In software development, there is a bit of a trade off. When you take a language like Python and look under the hood, you start to realize the flexibility and development speed comes at a little bit of a cost of speed, and memory efficiency.

You may be recoiling in horror at that sentence -- why would you want to build software that isn't as fast and as efficient as possible?

Well, first off, a lot of the time your business logic and calculations will not even remotely phase a modern processor. Imagine we print a pdf with a client's contract from information we've fetched from a client database -- that will happen quite quickly built in Python, or any other programming language. Most of the time, the loss of software speed is not noticeable, when it comes down to a fraction of a second vs. a fraction of a second, and bottlenecks like database speed eclipse software speed.

But still, there are events involving "expensive" computations, e.g. things which do not take a computer fractions of a second. And, there are events which do take only fractions of a second, but are initiated many, many times by many users. Building the code well involves reducing these points of friction to the most efficient algorithms, but some times we reach the limitations of Python itself as an appropriate systems language.

Well, time to put your mind at ease, because there's Rust.

Rust is pretty cool because it's built to be fast, has a unique system for eliminating memory leaks, and lets you get down to deep low level coding. It can accommodate those cases where speed really matters, where the concurrency (multiple users at once) must be faster and more reliable.

So what does that mean practically? Well, I put Rust and Python to the test, solving a complicated mathematical equation on a large array of numbers. This could just be anything from a complicated calculation on a client's financial transaction history, or anything crunching a lot of data. Python took 14.03 seconds to get the formula done. Rust took 0.7 seconds, it was over 200 times faster.

Now you might be worried again -- if you have to choose between Django and Rust, one is fast to build and quicker to change as you need (less expensive to build and maintain) but you want that extra speed for your important software, what can you do?

Lucky for you, you don't really have to choose, you can have a blend of a quick and powerful framework like Django which can actually call on executable files built in Rust. It's 100% possible to build 95% of your system that does not really rely on fast computational efficiency in Django, making it all very easy to change at a moment's notice as well as build in the first place inexpensively, and then build out the really resource intensive features you need in a systems programming language like Rust. And shameless plug, I just so happen to know Django extremely well and I know Rust well too -- If you have any vision for software for your business we can build it together.