Anomaly detection is an important task for hyperspectral data exploitation. A standard approach for anomaly detection in the literature is the method developed by Reed and Xiaoli, also called RX algorithm. A variation of this algorithm consists of applying the same concept to a local sliding window centered around each image pixel. The computational cost is very high for RX algorithm and it strongly increases for its local versions. However, current advances in high performance computing help to reduce the run-time of these algorithms. So, for the standard RX, it is possible to achieve a processing time similar to the data acquisition time and to increase the practical interest for its local versions. In this paper, we discuss several optimizations which exploit different forms of acceleration for these algorithms. First, we explain how the calculation of the correlation matrix and its inverse can be accelerated through optimization techniques based on the properties of these particular matrices and the efficient use of linear algebra libraries. Second, we describe parallel implementations of the RX algorithm, optimized for multicore platforms. These are well-known, inexpensive and widely available high performance computing platforms. The ability to detect anomalies of the global and local versions of RX is explored using a wide set of experiments, using both synthetic and real data, which are used for comparing the optimized versions of the global and local RX algorithms in terms of anomaly detection accuracy and computational efficiency. The synthetic images have been generated under different noise conditions and anomalous features. The two real scenes used in the experiments are a hyperspectral data set collected by NASA's Airborne Visible Infra-Red Imaging Spectrometer (AVIRIS) system over the World Trade Center (WTC) in New York, five days after the terrorist attacks, and another data set collected by the HYperspectral Digital Image Collection Experiment (H- DICE). Experimental results indicate that the proposed optimizations can significantly improve the performance of the considered algorithms without reducing their anomaly detection accuracy.