This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 7580 - TranscodingActionDeleteScript: one call to preg_replace would be better
Summary: TranscodingActionDeleteScript: one call to preg_replace would be better
Status: NEW
Alias: None
Product: mobileOK authoring tools
Classification: Unclassified
Component: Transcoding (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 enhancement
Target Milestone: ---
Assignee: Sylvain Lequeux
QA Contact: fd
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-11 15:06 UTC by fd
Modified: 2009-09-11 15:25 UTC (History)
0 users

See Also:


Attachments

Description fd 2009-09-11 15:06:18 UTC
Problem with the "foreach" on the list of attributes is that content needs to be parsed as many times as there are attributes to look for, whereas it could be parsed only once.

Two ways to improve current loop:
1. use the possibility provided by preg_replace to take an array of patterns as argument and fill $patterns with all the possibility before issuing one and only call to preg_replace. I am not sure how preg_replace is optimized internally though. The result may be the same, and that sure isn't that optimized.

2. use the foreach loop to generate a pattern list of the form:
 on(load|unload|click|dblclick|mousedown|...)
... and then have $patterns contain the 3 possible combinations of the resulting pattern.
Comment 1 fd 2009-09-11 15:25:52 UTC
Changing bug's title, I had fixed the regexp problem.