Developer Intern – Embium

Embium Logo

I was very fortunate to be hired as a Developer at Embium on my second work term. It was a great work term that allowed me to return to my favourite language (C#) as well as expose me to a new one (F#). Not only did I pick up a new language, I also got my first experience with the functional programming paradigm that accompanies F#. I learned a ton and tried plenty of new things, but my term was really characterized by the performance and reliability improvements I made. Below are some brief blurbs about some of what I worked on:

I was asked to improve the order latency of our system and was given relatively free reign to accomplish it. I utilized ANTS Performance Profiler to identify areas of code that were causing the biggest slowdowns, and found a fix that suited each unique issue. Some of the solutions I came up with were:

  1. Added database caching to prevent the extra overhead of unneeded database hits
  2. Implemented deferred execution to ensure that code was only executed once it could be determined that it actually needed to be executed
  3. Removed code from the critical execution path by passing off code that could be completed asynchronously onto thread pooled threads
  4. Migrated some information passing classes to immutable F# classes to prevent the need for overhead incurred from cloning
  5. Made small improvements (such as changing from a List to a HashSet for faster .Contains checks) in most highly trafficked code, effectively multiplying the small changes hundreds of times

The migration to immutable classes deserves a section of its own. It required extensive refactoring that resulted in changes to hundreds of files. I relied on a wonderful plugin called ReSharper to do a lot of the heavy lifting for me, allowing me to identify patterns that needed to be changed, and then simply rely on the tool to carry out the refactoring. Extensive changes in the logic were also required to facilitate the paradigm shift to immutability.

I worked with fellow co-op students to develop and automated integration testing framework. The framework automatically launches and configures the system, then begins launching algorithms and sending orders and testing their results. This framework is easily extensible with new tests and allows Embium to immediately detect regressions in the future.