Skip to content

Replace C libraries student project

jdm edited this page Sep 26, 2014 · 4 revisions

Evaluate replacing C libraries with modern Rust equivalents

Background information: Servo currently depends on a lot of C libraries, because Rust equivalents did not exist when the project started. We want to evaluate switching some of these to new Rust libraries that have seen been created. This project involves rewriting the code that uses these libraries as well as taking measurements before and after to determine the costs involved.

Initial step: Build Servo, add timing code to the image decoding implementation in the net crate, rebuild Servo, and report numbers for different kinds of images (i.e. PNG, JPEG, GIF).

  • Build Servo and add code that reports (via println!) the time required to decode images into displayable pixels (image-related code)
  • Add image decoding timing to the profiler (see the image cache task for a good place to hook in, and this pull request for an example of interacting with the profiler)
  • Import the freetype-rs library to replace rust-freetype in Servo, rewriting necessary code (more info). Learn more about Cargo, our dependency manager for Servo.
  • Import the rust-image library to replace rust-stb-image and stb-image and rewrite load_from_memory (more info)
  • Report the timing differences for loading PNGs and non-PNGs on the same benchmarks. Consider profiling the result and optimizing the hotspots in rust-image

Note: we may not merge the changes to use rust-image during this project; this is an attempt to gather important information before we can consider doing so.

Clone this wiki locally