An implementation of the Prospero challenge in C# (along with a little interactive visualization)
Go to file
profan 1cb362a5ee add note about running 2026-06-07 18:51:07 +01:00
.idea/.idea.Sharpero/.idea implement basic constant folding, eliminating around 17 % of the instructions from the hot loop and folding it into the instructions 2026-05-31 17:19:15 +01:00
Programs some cleanup 2026-06-06 22:02:02 +01:00
.gitignore hmm 2026-05-25 17:51:38 +01:00
Program.cs add a little readme, factor things properly 2026-06-07 18:32:43 +01:00
README.md add note about running 2026-06-07 18:51:07 +01:00
Sharpero.csproj dependency 2026-06-07 18:49:01 +01:00
Sharpero.sln iNITIal commit, simd accelerated interpreter 2026-05-25 11:38:28 +01:00
Sharpero.sln.DotSettings.user implement optional compilation of inner loop to CIL, unrolling the loop into a number of functions we invoke 2026-06-06 20:49:12 +01:00
global.json iNITIal commit, simd accelerated interpreter 2026-05-25 11:38:28 +01:00
sharpero.png add image of the application to the readme 2026-06-07 18:41:55 +01:00

README.md

Sharpero

This is an implementation of an Interpreter/Compiler for the Prospero challenge, implementing some basic optimizations including removing constants from the instruction tape, vectorization, parallelization but also optionally compiling the loop of the evaluator to CIL prior to invocation.

It doesn't perform any sophisticated interval-arithmetic based optimizations (... yet), it's essentially a brute-force approach.

This program is also an interactive visualizer of the rendering process, allowing you to see exactly how it's writing the image data out, and toggle vectorization, parallel execution, compilation on/off and observe the effects on runtime.

The Application, in its 1024x1024 window

How do I run it?

You'll need .NET 10, with dotnet run -c Release that should be all you need for it to fetch all of its dependencies and run.

The only dependencies are RayLib-Cs (for the interactivity) and SkiaSharp (for writing out the image).

(Crude) Benchmark Results

On my own machine (CPU: Ryzen 7 4800HS), the results tabulate roughly as follows.

Compilation Parallelism Vectorization Evaluation Time Compilation Time
enabled enabled enabled 0.2s 0.2s
enabled enabled disabled 1.3s 0.2s
enabled disabled enabled 1.7s 0.2s
enabled disabled disabled 10s 0.2s
disabled enabled enabled 0.7s N/A
disabled enabled disabled 5.0s N/A
disabled disabled disabled 48s N/A

Recommendations

Probably don't use this with some kind of agentic LLM workflow, bad things might happen :)

Don't say I didn't warn you.

License

MIT/X11