Let me set it out the beginning of this story:
You must be wondering what the hell 28sec and 1 second. But don’t worry you will get to know everything.
I started my new journey in Kuliza from 28th January and soon I was fully involved in product team. But Suddenly one day, I vividly remember that was on 15th February, my manager told me that we’ve got one Matlab project and they just want to convert the Matlab code to Python. When I heard that, I burst out laughing :D. Convert Matlab code to python.
Thats how I kicked off this project.
So I went through the Matlab code and believe me all the time i was thinking what the hell it was. It was really hard to make something out from that code. I was thinking dude first you have to understand this code and have to rewrite in python.
I started looking python library that my manager suggested. After putting my almost 4 days, I was able to run Matlab code into Python and guess what that python code was taking 28 seconds to run.
So I was very excited because I converted into python and getting output similar to matlab code. I sent a mail out to my team. Next day I told to my manager and he was very happy after hearing that news. I thought my task is done in this project but that was just the beginning and after few hours my manager said, that we need to optimize this code, it’s taking really too much time.
I said to myself, OMG. For optimizing the code you need to understand each and every line of that code. I thought it’s time to show your talent. I tried all ways, posted my problem on stackoverflow, read couple of Numpy related blogs but initially didn’t get any good success :(. but finally I came across one blog that gave some couple of tips to optimize Python code by using Numpy library. I tried all those things and guess what I was able to run that code in 12 seconds :).
I said to myself dude, you nailed it. I was so engrossed at that time that forgot to see the time. You know that was the sunday midnight. I was very excited and wanted to share with someone but time was not good to wake someone up. So I tweeted on twitter. 😛 that was my first tweet in last six months. :).
When I came to office next day, I told my story to my manager. Everyone seemed to be very happy, my manager and even client too. So here you must be wondering that story ends here. If you are thinking that way then just wait, I have something more to tell. Here comes very pivotal part of this story.
After that I moved to one another 100 Million project. Though I moved to another project but believe me I was not happy with that output and always thinking how could, code take that much time to run, I tried so many things but reached to only 10 seconds.
So while working in 100 Million projects, I came across one powerful language NodeJS. A language “jiski jitni bhi tarif karo vo kam hai”.
There were few hurdles came while writing code into nodeJS like getting library similar to Matlab functions etc. but I came through all of them. After writing complete code, when I ran it first time in nodeJS, Guess what, It turned out really damn cool.
I was blown away when I saw output in one second. I was completely thrilled and jumped from my bed. You might be thinking bed in office ;). ( Actually, these interesting stuff, I do during weekends and at home :)).
So finally I created API in nodeJS and now we are hitting these apis from Django server. So all computations are being done in nodeJS and Djanog is taking care of all UI rendering stuffs.
So this is all about a beautiful journey from 28 seconds to 1 second. I enjoyed a lot while working in this project and I hope you have enjoyed reading this too.