Results 1 to 5 of 5

Thread: What is faster, QRegExp, or QByteArray::indexOf

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: What is faster, QRegExp, or QByteArray::indexOf

    Impossible to say, without knowing the implementation details of the regexp package you're using. The only way to be sure would be testing in a profiler.

    Note that there are a number of string-searching algorithms that are faster than brute-force linear search (look up the Boyer-Moore algorithm, for example). Good regexp packages tend to use such algorithms, but the regexp object itself introduces some overhead.

    Honestly, I would code up the simplest thing I could think of, then run the whole program through a profiler ONLY IF performance was a demonstrable issue. Only at that point would I consider retooling the string search, and then only if it proved to be a significant bottleneck. Premature optimization is the root of all evil.

  2. The following user says thank you to SixDegrees for this useful post:

    _Stefan (15th September 2010)

Similar Threads

  1. QList<A*> indexOf
    By Moppel in forum General Programming
    Replies: 6
    Last Post: 8th August 2017, 14:17
  2. Replies: 9
    Last Post: 25th July 2009, 13:27
  3. QString::indexOf Qt::CaseInsensitive
    By Carlsberg in forum Qt Programming
    Replies: 3
    Last Post: 19th May 2009, 18:11
  4. Faster paintEvent
    By SailinShoes in forum Qt Programming
    Replies: 1
    Last Post: 1st October 2008, 15:25
  5. Faster code possible?
    By ShaChris23 in forum General Programming
    Replies: 1
    Last Post: 28th May 2008, 07:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.