Constraint Logic Programming (CLP) languages extend logic programming by al
lowing the use of constraints from different domains such as real numbers o
r Boolean functions. They have proved to be ideal for expressing problems t
hat require interactive mathematical modeling and complex combinatorial opt
imization problems. However, CLP languages have mainly been considered as r
esearch systems, useful for rapid prototyping, but not really competitive w
ith more conventional programming languages where efficiency is a more impo
rtant consideration. One promising approach to improving the performance of
CLP systems is the use of powerful program optimizations to reduce the cos
t of constraint solving. We extend work in this area by; describing a new o
ptimizing compiler for the CLP language CLP(R). The compiler implements six
powerful optimizations: reordering of constraints, bypass of the constrain
t solver, splitting and dead-code elimination, removal of redundant constra
ints, removal of redundant variables, and specialization of constraints whi
ch cannot fail. Each program optimization is designed to remove the overhea
d of constraint solving when possible and keep the number of constraints in
the store as small as possible. We systematically evaluate the effectivene
ss of each optimization in isolation and in combination. Our empirical eval
uation of the compiler verifies that optimizing compilation can be made eff
icient enough to allow compilation of real-world programs and that it is wo
rth performing such compilation because it gives significant time and space
performance improvements.