Skip to content

A toy financial instrument exchange for experimentation with and comparison of programming languages

License

Notifications You must be signed in to change notification settings

GaryHughes/Exchange

Repository files navigation

Part 1 - C++ Part 2 - C++ Part 1 - C# Part 2 - C# Part 1 - F# Part 2 - F# Part 1 - Go Part 2 - Go Part 1 - Rust Part 2 - Rust Part 1 - Swift Part 2 - Swift Part 1 - Java Part 2 - Java Part 1 - Python Part 2 - Python Part 1 - C Part 2 - C Part 1 - TypeScript Part 2 - TypeScript Benchmark

What is this?

Exchange is a playground to experiment with and compare programming languages by solving a simple problem in your language of choice and then seeing how fast you can make it run.

The problem is broken into two parts, for Part 1 the goal is to solve the basic problem using idiomatic, expressive, readable code without too much though given to performance. For Part 2 all bets are off and the goal is to make it run as fast as possible.

Benchmarks

The solutions are benchmarked by taking the build artifacts for each language and running them 5 times over the supplied input files. The median runtime is recorded. All solutions are run on the same container instance sequentially, the results will vary depending on what resources the particular machine has at run time and will typcially be noticably slower than the results you will see on modern desktop hardware.

Some solutions are excluded from the benchmarks entirely because they take too long to run even once. Others are exluded from the benchmark with the larger file because they take too long for that particular input.

Part 1 Performance

cannot access local variable 'i' where it is not associated with a value cannot access local variable 'i' where it is not associated with a value cannot access local variable 'i' where it is not associated with a value

100K orders trades
C# 0:00:00.567802 3368
F# 0:00:03.386436 3368
Go 0:00:05.518164 3368
Swift 0:00:05.681755 3368
C 0:00:09.206282 3368
C++ 0:00:19.502107 3368
Python 0:01:21.226576 3368

Part 2 Performance

The slower implementations are excluded from the larger benchmark just so it runs in a reasonable time.

cannot access local variable 'i' where it is not associated with a value cannot access local variable 'i' where it is not associated with a value cannot access local variable 'i' where it is not associated with a value cannot access local variable 'i' where it is not associated with a value cannot access local variable 'i' where it is not associated with a value cannot access local variable 'i' where it is not associated with a value

100K orders trades
C 0:00:00.022948 3368
C++ 0:00:00.037377 3368
Go 0:00:00.047072 3368
C# 0:00:00.173053 3368
Python 0:00:00.286673 3368
F# 0:00:00.336410 3368
Swift 0:00:00.523947 3368
10M orders trades
C 0:00:02.025696 360131
C++ 0:00:03.375003 360131
Go 0:00:05.055119 360131
C# 0:00:08.456755 360131
F# 0:00:19.928944 360131

About

A toy financial instrument exchange for experimentation with and comparison of programming languages

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •