Re: Could this be faster?

new topic     » goto parent     » topic index » view thread      » older message » newer message

C Bouzy wrote:
> 
> if equal(ItemEntry[D_ATTRIBUTES], "d") then  ----If directory do nothing
> 
>   else
>          if match("aac", get_file_ext(lower(ItemEntry[D_NAME]))) or   ---- If
>          supported file add to the Playlist
>          match("mp4", get_file_ext(lower(ItemEntry[D_NAME]))) or
>          match("mp3", get_file_ext(lower(ItemEntry[D_NAME]))) or
>          match("mp2", get_file_ext(lower(ItemEntry[D_NAME]))) or
>          match("mp1", get_file_ext(lower(ItemEntry[D_NAME]))) or
>          match("ogg", get_file_ext(lower(ItemEntry[D_NAME]))) or
>          match("wav", get_file_ext(lower(ItemEntry[D_NAME])))
>   then

It might be faster to do this:

ext_list = { "aac", "mp4", "mp3", "mp2", "mp1", "ogg", "wav" }

if find(get_file_ext(lower(ItemEntry[D_NAME])),ext_list) <> 0 then...

That way you only have one call to lower(), one subscripting of D_NAME, one
call to get_file_ext(), etc., though I can't imagine it would be tons faster.
Let me know! :)

-=ck
"Programming in a state of Euphoria."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu