bugGNU Octave - Bugs: bug #39430, regexp: performance for cell...


bug #39430: regexp: performance for cell arrays is slow

Submitter:  Rik <rik5>
Submitted:  Sun 07 Jul 2013 11:55:02 PM UTC
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Performance
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Mon 21 Nov 2016 10:17:37 PM UTC, comment #1: 

This issue is still present in Octave 4.2.0.

Hartmut <hardy>
Sun 07 Jul 2013 11:55:02 PM UTC, original submission:  

The performance of regexp is an order of magnitude slower than the same functionality in strfind.  Some performance penalty is expected, but not this great.

Sample Code:

octave:71> xc = cellstr (char (randi( [65 65+25], [1e5, 20])));
octave:72> tic; yr = regexp (xc, 'ABC'); toc
Elapsed time is 2.5726881 seconds.
octave:73> tic; y = strfind (xc, 'ABC'); toc
Elapsed time is 0.20126295 seconds.

There seem to be several causes.  It appears that Octave is re-compiling the PCRE pattern every time it does a match for one row.  Octave is also bothering to process and restore all possible return values (start, end, tokens, tokenextents, match, and splits) even if only a subsection is desired.  I haven't done a hotspot analysis though.

Rik <rik5>
Group administrator


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by hardy (Posted a comment)
  • -email is unavailable- added by rik5 (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.


    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-3cd0.
    Corresponding source code