A clean-tech startup had a mathematical model that could predict energy use well enough to trade electricity in 30-minute windows. The problem: a single prediction took hours to compute, and the trading window closed in 25 to 28 minutes. Together with their scientists, we took the computation from several hours to under 30 seconds using GPUs, and turned a research model into the core of a production platform.
About the customer

Tempus Energy was a UK clean-tech startup, founded in 2012 by Sara Bell. It built a platform that used algorithms to shift the energy use of flexible assets to periods when electricity is cheap and clean. Tempus launched what it described as the world’s first flexible electricity retailer, worked with business customers such as Hertz, Avis and EAT, and partnered with Origin Energy on a demand-flexibility trial in South Australia.
Tempus also fought for its market. In 2014 the company challenged the design of the UK Capacity Market in the European courts, arguing it favoured fossil-fuel generation over flexible demand. In November 2018 the EU General Court ruled in Tempus’s favor and annulled the scheme’s approval, suspending the entire capacity market. The market was not ready to reward what Tempus’s software made possible, and the company has since ceased trading. Its technology and business model, however, were ahead of its time: what Tempus pioneered in the 2010s is now a mainstream industry, with the UK grid operator paying millions of households and businesses for demand flexibility. Read more about their story in the Guardian.
What is demand-side response?
Electricity supply must match demand at every moment, but demand is not fixed. Some energy use can safely shift in time: charging a battery, cooling a warehouse an hour earlier, delaying a pump. Demand-side response (DSR) is the practice of shifting that flexible consumption to moments when electricity is abundant, cheap and clean, and away from moments when the grid is strained and backup fossil plants set the price. For a business with flexible assets, DSR means lower energy bills and revenue from grid services; for the grid, it reduces the need for peaking plants and helps integrate renewables. Tempus’s platform predicted price and carbon-intensity volatility, and used those predictions to control and optimize when its customers’ assets used energy.
The challenge
Tempus’s model predicted the energy usage of a group of flexible assets, so that trades of that area’s energy could be made accordingly for the coming 30 minutes. The model itself, built by the company’s scientist, a mathematician, was good. The implementation was not yet production-ready: a single prediction run took hours, while the trading decision had to be made within 28 minutes of window opening.
The software was a proof of concept. To run a real trading business, Tempus needed:
- Predictions within 20 minutes, not hours, so every 30-minute trading window could be used.
- Deterministic, repeatable results, since real money was being traded on the output.
- A production-grade system, not a research script.
The gap between the PoC and a live trading platform was the gap between an interesting algorithm and a business.
Our approach
The model was designed by a mathematician, and the performance problem lived at the intersection of the mathematics and the code. We built CPU and GPU implementations of the prediction at the same time, restructuring the computation based on what the model actually meant rather than throwing hardware at the problem.
Working as one team with the client’s scientists
The strongest point of this project was the collaboration with Tempus’s scientists. We did not fully understand their domain, and they did not fully understand ours. But by explaining what we wanted to change and why, and by asking the right questions about what the model could tolerate, we found the transformations together. We did not need daily meetings: we established a rhythm that respected each other’s time without delaying the work. That trust is what allowed changes to the mathematics, not just the code.
Removing work from the central loop
The deepest win came from the model’s central loop: part of the computation inside the loop did not depend on the loop itself, so we hoisted it out and computed it once. This is where knowing the mathematics mattered most. A compiler cannot make that call; the transformation is only safe if you understand what the equation means.
Keeping intermediate data on the GPU
As a last optimization, we only focused on the GPU. The model’s inputs were small, and so was the output. The volume came from intermediate results generated during the calculation. Moving that intermediate data back and forth between CPU and GPU would dominate the runtime. By keeping the entire pipeline on the GPU, we avoided the memory traffic altogether. Since the data was mostly intermediate, almost nothing had to leave the GPU at all.
The result
- From hours to under 30 seconds. The prediction ran comfortably within the trading window, on both CPU and GPU implementations, turning the model into the engine of a production trading system.
- A speedup of more than 100x. The same computation that previously kept CPUs busy for hours now finished before a quarter of the trading window was gone.
- An option to use the CPU as fall-back. In trading the fastest wins, as that gives more time for the actual trading. Also, the original Python-code was made faster by the scientist himself after seeing our code, allowing him to continue research more efficiently.
- The full day, simulated live. Fast enough that whole-day simulations, previously an overnight job, became interactive tools for the company’s scientists.
- A platform the business could trade on. Tempus could act on its own predictions while the trading window was still open.
Story time. After the project we got an angry call from one of their employees: the simulation had been running for over 5 minutes now, where was the promised half minute? Then his colleague in the same room pointed out it was the simulation for the whole day. He apologized and hung up.
Key takeaway
Performance engineering is most valuable where it turns a working model into a viable product. Tempus’s algorithm was already good enough to trade on; the runtime was the only thing standing between a research result and a business. The breakthroughs came from a collaboration in which both sides learned enough of the other’s field to make the right decisions together. This trust in each other allowed that 100x speedup on production-level software.
We love working with R&D-heavy startups whose challenge is not what to compute, but how to compute it fast enough to build a business on. If that sounds like you, get in touch.
Did you enjoy reading about how we made a new market possible, technically? You can read about more projects we worked on by checking out our other case studies.