[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #64898] Slow zeros
|
From: |
Petter |
|
Subject: |
[Octave-bug-tracker] [bug #64898] Slow zeros |
|
Date: |
Mon, 20 Nov 2023 15:56:31 -0500 (EST) |
Follow-up Comment #2, bug #64898 (project octave):
;A(1)=1;
That will probably only make the OS allocate one page of about 4kb, in Matlab.
The zero pages are usually lazy.
In the end if the matrix is used in all elements I guess the runtime will be
about twice as fast with calloc() as the first memset() is redundant for
zeros. But only for a small matrix. I don't think there are 3Gb of zeroed
pages available most of the time.
Could you try:
tic;A=zeros(20000);A(:,:)=1;toc
in Matlab and compare to Octave on you computer.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?64898>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/