I'm a fourth year Computer Science student at the University of Cambridge.
Here are some of the projects I've worked on:
It was originally my A-level coursework project, but I enjoyed working on it so much I'm continuing development in my spare time.
While Python has a reputation for being slow (and, due to the GIL, is incapable of true multithreading), by using Cython to interface with C libraries and optimise bottlenecks, one of those two problems can be solved.
Features include painless script writing, thanks to Python's simple syntax, and the ability to hot reload code while the game is running, minimising time wasted restarting every time you make a change.
The client was created as part of a two-day collaborative jam using HTML/JS (click here to try it out). The server and spec were created in advance, but evolved as we went on. Features include an account system with passwords, multiple channels, and markdown support. And then...
based on the abstraction of commands encoded in JSON sent over some transport, able to asynchronously serve many users at once. The aim was to minimise boilerplate, so the below code works as you expect:
import jsonServer
server = jsonServer.Server()
@server.command
async def add(ctx, a, b):
return a + b
server.run()
The server we were using for the jam worked at the time, but I suspected it would only be temporary, so I made my own as a learning exercise (and to ensure the client would always function).
The framework I wrote was based on sockets, rather than websockets, but it was easy enough to extend it (since it used generic reader and writer objects, and allows you to swap your own in).
I chose to use SQLAlchemy as an ORM to get some experience with it, which really helped keep the code looking clean.
Butty is a Discord bot collaboratively written to suit the needs of myself and my friends, with a disparate array of features including: Playing music, either by direct url or by automatically searching YouTube; Time based reminders; and moderation assistance.
Compiles the L* family of languages to x86 via rust. Represents each program as a unique type, allowing for great optimisation from LLVM while keeping the implementation as close to the operational semantics as possible.
//computes the sum of integers from 0 to 1 billion
//compiles to 14 lines of ASM, with no backwards jumpsl1 := 10000000000;
l2 := 0;
while !l1 >= 1 do
l2 := !l2 + !l1;
l1 := !l1 + -1
The compiler uses CPython's internal bytecode, analyses it, optimises it, and then generates WASM as output.
Optimisations applied include static allocation of small integers and constants; direct function calls to reduce pointer chasing; and speculative static typing, which uses user-supplied type hints to produce two versions of a function, one of which has static typing optimisations applied (similar to a JIT).Performance was typically at or greater than CPython, with one benchmark seeing a 2.3x speedup!
Other things I've made: