Any way to speed up array based file browser (or, are there alternatives?)

125 views
Skip to first unread message

Cptnodegard

unread,
Oct 21, 2012, 8:38:34 AM10/21/12
to tas...@googlegroups.com
Playing around with an array based file browser that basically works like this:

List Files in / -> %Fbrowser
Show Scene Browser
    V
Menu scene element, Array, %Fbrowser
    V
Tap:
-Variable Set %selected to %select_indices+1 (do maths)
-Variable Set %selected to %Fbrowser(%selected)
-Array Clear %Fbrowser
-List Files in %selected

then obviously, while I havnen't implemented it yet, you'd have Long Tap Variable Set %selected to %Selected or whatnot. 


This works, problem is that it's slow. Depending on the amount of crap in the particular folder, it can take half a minute to clear the variable, then repopulate the menu with the new values. 

Any ideas?

Richard Davis

unread,
Oct 21, 2012, 3:53:08 PM10/21/12
to tas...@googlegroups.com

Having trouble following the logic in your post but I have a made a file browser that works quickly.  Here is what i found along the way.

1. Any array or even large variable functions should always be done on a local array or variable, it is much faster to convert to a local then back to a global if necessary than perform these functions on a global array or variable.

2. Always try to use the comma separated variable instead of a array  for your menu in the scene. 

So I would recommend starting with list files / %fbrowser and do every thing you can in the one task if possible then at the end set the set the global variable for your menu with a file variable join /,/

Hope this helps,          Rich..

Cptnodegard

unread,
Oct 21, 2012, 4:27:26 PM10/21/12
to tas...@googlegroups.com
Hmm are we talking about the same kind of menu in a scene? Because the Menu scene element doesn't have a source option for comma separated values as I can see, and the source cannot be a local variable. What slows this down is populating and repopulating the menu element. 

Richard Davis

unread,
Oct 21, 2012, 4:50:42 PM10/21/12
to tas...@googlegroups.com


> Hmm are we talking about the same kind of menu in a scene?

Yes..

Because the Menu scene element doesn't have a source option for comma separated values as I can see,

Just select -variable- under -source-

and the source cannot be a local variable.

Correct

What slows this down is populating and repopulating the menu element. 

Yup...  I was having trouble with speed and the menus not updating when the array was set and when I changed to a comma separated variable all my troubles went away.. ( The variable join is very fast even with large arrays but again be sure to use local variables until yo need to set the global variable for the menu....)

" Try it you'll like it...."  :)

Rich...

Richard Davis

unread,
Oct 21, 2012, 4:57:27 PM10/21/12
to tas...@googlegroups.com

Oops,   I just check and at the end I do not use a variable join I use..

Variable set %Globalmenuevariable to %arr(:)

Rich....

Cptnodegard

unread,
Oct 21, 2012, 5:04:02 PM10/21/12
to tas...@googlegroups.com
I get you now, that does work much faster, thank you! What system do you use for moving between folders? Might be something easier than what I'm doing there too. 

Also, is single selection in menu working for you? It isn't for me.

Richard Davis

unread,
Oct 21, 2012, 5:17:52 PM10/21/12
to tas...@googlegroups.com


On Oct 21, 2012 5:04 PM, "Cptnodegard" <andreas...@gmail.com> wrote:
>
> I get you now, that does work much faster, thank you! What system do you use for moving between folders?

I will have to get back to you on that one. I had it set up to move between folders and it was working fine then I changed the entire thing and only use one folder now. But I think my original work is here some place.

>
> Also, is single selection in menu working for you? It isn't for me.

Yes..  I saw your other post.  I have mine set to single and use the tap option and go from there..  do you use the tap option??

Cptnodegard

unread,
Oct 21, 2012, 5:21:30 PM10/21/12
to tas...@googlegroups.com
Yep I use the tap option, but when I use single selection it doesn't populate %select_indices

Cptnodegard

unread,
Oct 21, 2012, 5:25:13 PM10/21/12
to tas...@googlegroups.com
Much, much faster now, even though the Item Tap task isn't very elegant. had no idea that it would slow it down so much to use a global array compared to transferring a local array into a comma separated global variable. it's like night and day, and then some. thank you!

Richard Davis

unread,
Oct 21, 2012, 5:32:47 PM10/21/12
to tas...@googlegroups.com


>
> Yep I use the tap option, but when I use single selection it doesn't populate %select_indices
>

I only use the %tap_label.  I am a little short on time now but I will test the %select_indices for you later and get back to you...

Rich...

Cptnodegard

unread,
Oct 21, 2012, 5:38:37 PM10/21/12
to tas...@googlegroups.com
Ugh I wasn't even aware there was a %tap_label. never looked further than the directly accessible help bit, which only mentions %select_indices >.>

fucking hell....

Richard Davis

unread,
Oct 21, 2012, 5:43:22 PM10/21/12
to tas...@googlegroups.com

Been there... done that...  :)

Cptnodegard

unread,
Oct 21, 2012, 5:54:00 PM10/21/12
to tas...@googlegroups.com
I "feared" that my todo list was now way too complicated because I was under the impression that %select_indices is everything. I've been matching the %select_indices numbers (plus one since they don't both start at 0) to array element numbers, essentially getting the label by matching the index number to the element number. "Luckily" my todo list system is quite different than a file browser, so that method is actually better I think. I store my todo list items in a text file and an array, and delete items by allowing multiple selections in the menu, then using the numbers from %select_indices to simply Variable Pop stuff out of the array. 

That todo list is my life, so glad I didn't have to change anything, but your help completely rewrote my file browser. Which means that one of the examples in the draft for part 7 of my tasker guide is now garbage. I guess this proves more than ever that there's a need for a third party guide, at least saving others from making the same mistake. 

Richard Davis

unread,
Oct 21, 2012, 8:33:36 PM10/21/12
to tas...@googlegroups.com


> I "feared" that my todo list was now way too complicated because I was under the impression that %select_indices is everything. I've been matching the %select_indices numbers (plus one since they don't both start at 0) to array element numbers, essentially getting the label by matching the index number to the element number. "Luckily" my todo list system is quite different than a file browser, so that method is actually better I think. I store my todo list items in a text file and an array, and delete items by allowing multiple selections in the menu, then using the numbers from %select_indices to simply Variable Pop stuff out of the array. 
>

Hmmmm,  It sounds like a good way to go if there is no speed issues. I have not used the multi select on the menu yet but I would assume I would get a comma separated variable from %tap_label then with the new and improved variable search and replace about to hit the floor(which of course was not available when you wrote your profile) I think you could use that for the delete items. I believe that if you can find a way to process data with a comma separated variable using variable split, join,search and replace it is faster than using an array even if it means more actions to accomplish it..   Just my humble opinion ...

Pent

unread,
Oct 22, 2012, 2:08:05 AM10/22/12
to Tasker
Which Tasker version are you using Andreas ? I thought I'd speeded up
the array clear with global vars (the speed difference is mostly due
to the broadcasts necessary for global variables e.g. to trigger
Variable Set events).

Pent

Cptnodegard

unread,
Oct 22, 2012, 2:24:33 AM10/22/12
to tas...@googlegroups.com
There aren't really any speed issues because the list rarely has very any items in it. Might have to redo it eventually, but variable s/r and I got off on a wrong foot so I'm not overly comfortable with it :p

Using 1.3.2.b1m.

Cptnodegard

unread,
Oct 22, 2012, 2:29:31 AM10/22/12
to tas...@googlegroups.com
As for speed, Rich's help made a folder refresh in the file browser drop from 30 seconds to about 2 on large folders. Decently fast device too, galaxy s ii

Richard Davis

unread,
Oct 22, 2012, 6:11:46 AM10/22/12
to tas...@googlegroups.com


>
> As for speed, Rich's help made a folder refresh in the file browser drop from 30 seconds to about 2 on large folders. Decently fast device too, galaxy s ii
>

Pent, I believe there is a bug When updating a scene menu With an array. 
It is extremely slow and %tap_label will not always get updated when the array is set. I'm not sure if you saw this post.

https://groups.google.com/group/tasker/browse_thread/thread/4cd9e6560fd0d09f/fa34810943ed089c?hl=en&lnk=gst&q=update+scene+menu#fa34810943ed089c

Rich...

Richard Davis

unread,
Oct 22, 2012, 4:06:08 PM10/22/12
to tas...@googlegroups.com

Pent,  I just wanted to bump this up to make sure you saw this additional bug with scene / menu while your fixing the %select_indices

Thanks,  Rich..

Pent

unread,
Oct 23, 2012, 4:23:37 AM10/23/12
to Tasker
> > Pent, I believe there is a bug When updating a scene menu With an array.
> > It is extremely slow

If you're using the beta it should be faster, it used to broadcast a
lot more when you push on an array.
Some other speedups:

- build the array before the scene is show, otherwise the menu is
refreshing all the time while you're building
- turn off logging, for loops generate a lot of logging
- turn off run log

> and %tap_label will not always get updated when the

I havn't noticed that, it might be improved in the beta (or the
development version I havn't published yet)

Pent

Richard Davis

unread,
Oct 23, 2012, 8:30:14 AM10/23/12
to tas...@googlegroups.com

Great... thanks for the reply and speed tips.. I haven't had a chance to get the beta but will give it a test drive soon....

Cptnodegard

unread,
Oct 25, 2012, 11:45:39 AM10/25/12
to tas...@googlegroups.com
Your speedup trick is doing wonders for my todo list, rich, which I find myself redoing once again. V2 vs V3 alpha:


Richard Davis

unread,
Oct 25, 2012, 2:03:49 PM10/25/12
to tas...@googlegroups.com

> Your speedup trick is doing wonders for my todo list, rich, which I find myself redoing once again. V2 vs V3 alpha:
> http://www.youtube.com/watch?v=8IT0H8m3dQ4

Looks nice... :)

I also came up with a work around for the lagging text edit box and was going to post it on your other thread but forgot.. it is here

https://groups.google.com/group/tasker/browse_thread/thread/1021fd5e7794b35b/c74ef519a26073ba?hl=en&lnk=gst&q=work+around+for+fast#c74ef519a26073ba

Although this might not be necessary any more, I think pent did some tinkering with the text edit box on the new beta.  I am going to take out my work around and test it when I get a chance...

Rich..

Richard Davis

unread,
Oct 25, 2012, 2:05:41 PM10/25/12
to tas...@googlegroups.com

Lol..... I just realized you were the other poster on that thread.... sorry...

Rich...

Cptnodegard

unread,
Oct 25, 2012, 2:20:59 PM10/25/12
to tas...@googlegroups.com
Finished the generic version of V3 of my list. It's so much faster it's stupid. I had to come up with a Element Visibility-based workaround for variables never being empty (they show their names, unlike arrays), but it doesn't affect performance. 

TomL

unread,
Oct 25, 2012, 2:35:05 PM10/25/12
to tas...@googlegroups.com
What hardware/OS version did you use in your video?  And what video recording app did you use to record it?

Tom

Cptnodegard

unread,
Oct 25, 2012, 2:36:30 PM10/25/12
to tas...@googlegroups.com
Galaxy S II running the last Android version worth a damned, aka Gingerbread (stock 2.3.5)

Rooted, allowing for the app Screencast to work

TomL

unread,
Oct 25, 2012, 2:48:29 PM10/25/12
to tas...@googlegroups.com
Nice.  The demo looks very snappy and responsive.  It's hard to believe that it's implemented as scenes in Tasker.

Tom

Cptnodegard

unread,
Oct 25, 2012, 2:49:45 PM10/25/12
to tas...@googlegroups.com
Thanks. This is V3, V1 lacked features and was very slow, V2 was slow. 

Richard Davis

unread,
Oct 25, 2012, 4:46:55 PM10/25/12
to tas...@googlegroups.com


>
> Thanks. This is V3, V1 lacked features and was very slow, V2 was slow.

Great news on the text edit box it looks like Pent fixed her good... :)

I took out my work around And now it's quicker and better than ever.
I can type as fast as I want And the 'Text Changed' option get every character... thank you very much Pent.......   :)  

Cptnodegard

unread,
Oct 25, 2012, 4:52:12 PM10/25/12
to tas...@googlegroups.com
V1-3 wasn't referring to Tasker, but to my todo list. I never had typing speed issues

Richard Davis

unread,
Oct 25, 2012, 5:00:58 PM10/25/12
to tas...@googlegroups.com

> V1-3 wasn't referring to Tasker, but to my todo list. I never had typing speed issues

Ah yes, sorry for posting off topic.. guess I got a little exited. It was more of a fyi because you had said in your other post you had a work around for the text edit box and I noticed you referenced a issue with the text edit box it in your guide as well..

Rich...

Pent

unread,
Oct 26, 2012, 2:04:21 AM10/26/12
to Tasker
> I can type as fast as I want And the 'Text Changed' option get every
> character... thank you very much Pent.......   :)

Err, must have been a side effect of something else, I didn't changed
that directly, unless I was sleep-programming at some point.

Pent

Richard Davis

unread,
Oct 26, 2012, 5:23:36 AM10/26/12
to tas...@googlegroups.com

:)   I would definitely recommend more sleep then ...  actually after more testing I think i need to take it out of "fixed her good" category and put it in "a definite improvement " category .. some times it is very responsive but other times it is still lagging however before any qued up text was lost but now no matter how much text gets qued it seems to get it all..

Rich..

Cptnodegard

unread,
Oct 26, 2012, 9:22:36 AM10/26/12
to tas...@googlegroups.com
Didn't you improve the way global vars are handled, pent? That could affect this as well if the value changed action writes to one
Reply all
Reply to author
Forward
0 new messages