gl-rs: Slow build time for gl::load_with usages

On my i5-3550 this code takes 3.2 seconds to build, which is quite a bit taking into account it is only loading the OpenGL library.

extern crate glutin;
extern crate gl;

fn main() {
    let window = glutin::Window::new().unwrap();
    unsafe { window.make_current() };
    gl::load_with(|symbol| window.get_proc_address(symbol));
}

It was tested with rustc 1.0.0-nightly (dfc5c0f1e 2015-02-18).

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 1
  • Comments: 15 (12 by maintainers)

Most upvoted comments

Now that I think about it, I would probably also create an inner function inside gl::load_with which takes &mut dyn FnMut and is also marked with #[inline(never)]. The outer gl::load_with would then only call the inner one. That way, the 700 calls are not inlined into user code.

I could submit this as PR, if you want. Or do you want to do it?

Published!

I’m pretty sure we removed the templates… I might not have remembered to close this issue