Matthew
Matthew

Reputation: 165

Will compiling common libraries myself improve performance?

As a hobby project, I am trying to compile the open source game Simutrans with Visual Studio Express 2015 (as a precursor to making some small changes to gameplay). It requires a few common libraries (bzip, pthreads, SDL, and possibly Allegro). Both the Simutrans compilation instructions and some of the SDL documentation seem to assume that people should or will build these libraries themselves. From searching Stack Overflow and other forums, I have learned that this is sometimes necessary if you are porting something to an exotic platform (BeOs on PowerPC?!), in order to improve your programming knowledge, or because you want specific compilation options. None of these apply to me: I am using a bog standard Wintel system and I don't want to learn about SDL; just learning C++ and Simutrans will take years. Will compiling the libraries from source on my own computer [edit: noticeably] improve performance in any way, or have any other advantage relevant to my situation?

This is my first programming project in almost three decades, so please assume you are talking to a complete beginner with minimal knowledge.

Upvotes: 2

Views: 65

Answers (1)

Chad
Chad

Reputation: 19032

When libraries are built to be used among a large population, they have to be built to the lowest common denominator.

Things that are taken into account when building libraries for deployment is what platforms they support, and what is the minimum required specs for any given deployment.

When compiling programs and libraries locally you can improve performance by targeting specific optimizations that are available on your hardware that may not be available on the minimum required hardware.

Something compiled with gcc -march=core-i7 can enable options that would make the software not run on a core i3, or an AMD FX, etc.

There are also optimzation tradeoffs you can make in terms of executable size vs. execution speed, vs. memory access types, etc.

For your given use case, I doubt you would see any noticeable performance impact. That said, I don't want to downplay the importance of these optimizations because for certain use they make an incredible difference.

Upvotes: 1

Related Questions