[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-patch-tracker] [patch #9276] decide between array slice referenc
From: |
Olaf Till |
Subject: |
[Octave-patch-tracker] [patch #9276] decide between array slice references and copies based on size |
Date: |
Thu, 2 Mar 2017 15:12:58 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0 |
URL:
<http://savannah.gnu.org/patch/?9276>
Summary: decide between array slice references and copies
based on size
Project: GNU Octave
Submitted by: i7tiol
Submitted on: Thu 02 Mar 2017 08:12:57 PM UTC
Category: Core : other
Priority: 5 - Normal
Status: None
Privacy: Public
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
Patched revision: default, 2bed6d6bb2e2, 2017-02-24 20:43+0100
Problem: with current array slice references, large arrays remain in memory
even if only a reference to a small part of them still exists.
Demonstration (in single user mode, swapping switched off):
octave:2> a = ones (500000000, 1);
octave:3> b = a(1:10);
octave:4> clear a
octave:5> a = ones (500000000, 1);
error: out of memory or dimension too large for Octave's index type
octave:5>
However, contrary to what I initially thought, no problem if array allocated
within function:
octave:1> function ret = mkarray ()
> a = ones (500000000, 1);
> ret = a(1:10);
> endfunction
octave:2> b = mkarray;
octave:3> c = mkarray;
octave:4> d = mkarray;
octave:5> ... and so on.
so if I had to decide now, I probably wouldn't apply the patch.
With patch, demonstrated problem is fixed:
octave:1> a = ones (500000000, 1);
octave:2> b = a(1:10);
octave:3> clear a
octave:4> a = ones (500000000, 1);
octave:5> c = a(1:10);
octave:6> clear a
octave:7> a = ones (500000000, 1);
octave:8> ... and so on.
Description of patch:
If slice reference leaves a certain proportion (configurable, default 50
percent) of array unreferenced, and this proportion corresponds to more than
getpagesize(), a copy is made instead of a reference. The same configure
option, set to 'no' or '0', disables slice references entirely. Set to '100'
for behaviour of unpatched Octave.
Make check gives:
Summary:
PASS 15008
FAIL 20
XFAIL 38
SKIPPED 204
with unpatched as well as with patched version, the latter both with slice
references enabled and disabled.
No test for patched behaviour can be supplied, since only feasible in single
user mode and without swapping.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Thu 02 Mar 2017 08:12:57 PM UTC Name: array-slice-refs-or-copies.cset
Size: 6kB By: i7tiol
<http://savannah.gnu.org/patch/download.php?file_id=39882>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/patch/?9276>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Octave-patch-tracker] [patch #9276] decide between array slice references and copies based on size,
Olaf Till <=