In this dev stream, Seve dives into Bun's newly released Foreign Function Interface (FFI) to see if it can optimize tscircuit's auto-routing algorithms. He focuses on porting the getObstacleAt
function to C and benchmarks its performance against pure JavaScript implementations in both Bun and Node.js (V8). Seve encounters several challenges, including type issues with Bun's FFI, C compilation flags, and unexpected optimization behaviors. He also explores different methods of passing data between JavaScript and C, and discusses the intricacies of accurate performance measurement. Despite initial expectations, the results show that the C implementation doesn't significantly outperform the JavaScript versions, leading to insights about V8's optimization capabilities and the complexities of cross-language optimization.
Share this post
Bun FFI Benchmarking: Optimizing tscircuit's Auto-Router
blog.tscircuit.com
Playback speed
×
Share post
Share post at current time
Share from 0:00
0:00
/
0:00
Transcript
Bun FFI Benchmarking: Optimizing tscircuit's Auto-Router
Exploring the potential of Bun's new Foreign Function Interface for speeding up obstacle detection
Sep 18, 2024
1
Share this post
Bun FFI Benchmarking: Optimizing tscircuit's Auto-Router
blog.tscircuit.com
Bun FFI Benchmarking: Optimizing tscircuit's Auto-Router