Building an Optimized Scilab

One relatively easy way to to increase Scilab's performance is recompiling it with a good compiler and an optimized BLAS library. See also the section called Hyperlinks in Chapter 8 to find out what optimized BLAS kernels are available and where to get them.

Our experience only suffices to explain the compilation on an ia32 Linux system. Here, gcc-2.95 or pgcc-2.95 are the compilers of choice.

The following options are a good starting point for further exploration. They apply to compiling Fortran and C code.

-march=arch

This option instructs gcc to generate code specifically for architecture arch. Among other things it sets -mcpu=arch. Furthermore, it forces -malign-loops, -malign-jumps, -malign-functions, and -mpreferred-stack-boundary to their optimum values for the selected architecture without braking the ABI. Therefore, it can be considered an optimization switch.

-malign-double

For systems with an original 1ntel P5 or above processor this option is an absolute must. Though it breaks the ABI, the gain in speed due to avoiding the misalignment penalty for 64bit-floats is tremendous, even on PPro (and derivative) systems with all write back caches enabled.

-O2

The workhorse optimization switch, -O2, activates a lot of optimizations. See node "Optimize Options" in gcc's info file, e.g. info -f /usr/info/gcc.info.gz -n "Optimize Options"

The optimizations toggled on by -O2 are well tested and do not produce excessively long text.

-funroll-all-loops

This switch increases the text size, speeding up some loops. YMMV.