Re: [ojAlgo-user] Performance tests
Mathematics, linear algebra and optimisation
Brought to you by:
apete
From: Niko B. <nik...@gm...> - 2007-05-18 10:07:13
|
Hi Anders I have a general comment about performance when working with large matrices. ************************************************************************ * It matters a lot in what order you access the data in memory. * ************************************************************************ Consider the following example, using MATLAB version 5.2.0 on a 3Ghz Pentium 4. >> M = ones(10000); % This matrix has a size of about 800 MB. >> v = ones(10000,1); % multiply >> tic;M*v;toc elapsed_time = 6.6870 % If M is symmetrical, this gives the same answer, but accesses memory differently >> tic;(v'*M)';toc elapsed_time = 0.2350 I have done similar matrix multiplication experiments in Java, with similar results. Although in Java you don't have very good control over how and where matrix elements are stored in memory, it is still often possible by re-arranging the order in which elements are accessed, to speed up things considerably. Niko Brummer |