octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #48943] Processing image freezes OS


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #48943] Processing image freezes OS
Date: Tue, 30 Aug 2016 05:19:39 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0

Follow-up Comment #2, bug #48943 (project octave):

Freezing the OS isn't good, but that might be an OS problem as a program going
outside its memory space or something as bad shouldn't be a problem with
modern operating systems.  (If you can identify a crash though and any sort of
message right before it happens, that would be good.)

Anyway, what you are doing violates some of the main tenants of interpreted
language processing.

1) Pre-assign memory.  If your count vector C() (a matrix really seeing the
image has three color planes) is not pre-assigned, every time an image value
greater than previous appears the whole vector has to be reallocated to a
bigger memory space to make room.  And if you have an 8-bit image with 3
planes, statistically speaking that could be a lot of reallocations.  And this
sort of memory exercising might be what is testing your OS.  For what it's
worth, Matlab used to be slow at this too, but improved over the years.  (I
think there are ways internally that could improve this, and it's been
discussed at OctConf sessions, but no one's implemented it.)  In any case,
pre-allocate memory.

2) Avoid indexing as much as possible.  That has to be interpretted and is
about ten times slower than inherent indexing through matrix multiplication,
sorting routines, logical indexing, etc.  There is a lot to learn about the
efficient ways of using the language.  As AW suggests, look for pre-existing
functions that are already optimized.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?48943>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]