Opened 14 years ago

Closed 14 years ago

#7238 closed patch (fixed)

Unsafe std::list access & O(n^2) algo where O(n) possible in [22239]

Reported by: danielk Owned by: cpinkham
Priority: minor Milestone: 0.22
Component: MythTV - General Version: head
Severity: high Keywords:
Cc: Ticket locked: no

Description

I'm not in a position to test the fix right now, but I've attached a patch that should at least compile.

The main problem is the size() access on the linked list in the deletion loops. This is both a very expensive call which can be replaced by the cheap empty() call, and also accesses data which can be invalidated during execution because we call it outside the lock.

A smaller inefficienct is that we call glDeleteTextures() with a single texture, we can easily convert this to a single call..

Attachments (1)

7238-v1.patch (2.2 KB) - added by danielk 14 years ago.

Download all attachments as: .zip

Change History (4)

Changed 14 years ago by danielk

Attachment: 7238-v1.patch added

comment:1 Changed 14 years ago by danielk

Milestone: unknown0.22
Severity: mediumhigh
Type: defectpatch
Version: unknownhead

comment:2 Changed 14 years ago by cpinkham

(In [22248]) Cleanup/optimization of the texture cleanup code in MythOpenGLPainter::Begin.

References #7238. Patch by Daniel, tested by me. After talking with Daniel, I'm only applying the OpenGL part of his patch because I'm unable to test the VDPAU portion. Once Daniel or someone else can confirm the VDPAU portion works OK, that part will be committed as well.

comment:3 Changed 14 years ago by danielk

Resolution: fixed
Status: newclosed

(In [22255]) Fixes #7238. Make sure we hold the lock for the linked list before using it & do not use size() which can be slow on linked lists.

Note: See TracTickets for help on using tickets.