yashsingh1/xdaforums huggingface dataset:
[Asus Transformer TF700] shaggydiamond:
Ended up enabling init.d support on stock rom and got it working now.

It was my first time handling the terminal but hey there's a learning curve here of course^^

Anyway browser feels very snappy when scrolling, and because I have a new router browsing is going so much faster.:good:

Maybe an unrelated question but has the Asus Memopad 301t the same i\o issues as our transformers?

Familymember here got one and I thought maybe I could let the script run there as well?
[Asus Transformer TF700] sbdags:
The feedback from the Memo crew is that the stock asus rom is pretty snappy so I suspect Asus are using upgraded hardware.
[Asus Transformer TF700] elfaure:
Like you realized, this script is mainly to fix slow I/O on older hardware. I experimented with doing this on a newer PC and it actually made browsing slower so this script only has a hardware window of usefulness. Newer hardware with hardware accelerated browser like with the 4.2 stock browser could end up outperforming the script's browser RAM cache depending on the platform. But if the directory structure is the same for the Memo then the script should be able to be loaded at boot and run as root just the same. The only way to know if it speeds it up or not is to try it. Shouldn't hurt anything or risk any brick if that's what you mean. There's no flashing going on here. Its just a boot script. It either fails or it succeeds.
[Asus Transformer TF700] sbdags:
I've added Mathon HD to the browser list

com.mx.browser.tablet
[Asus Transformer TF700] elfaure:
Sure beats having to add the whole code block for each browser; how easy was that? Even a noob could add browsers now. I'm glad _that pushed me into variables and functions but the initial slope of the learning curve was dauntingly steep. Precisely why I have chosen to wait a few weeks (besides my external sd corruption and then needing to get GParted live going to format it) to polish and release the final-final version. Add browser requests/bug reports/optimize code changes/etc keep trickling in.

Besides some cleanup and an additional mountpoint check before umount, the main change I will make next is to pull the mount_browser_cache() function definition above the do loop so it doesn't get defined just called for each loop iteration. That was my noob mistake and not understanding how undefined null variables were handled in sequential code execution.

Is this the last addition that [MENTION=5117542]Tylorw1[/MENTION] was referring to when he sent me the wrong version? Adding this and fixing the typo for UC HD completes the list then, correct?
[Asus Transformer TF700] sbdags:
Yes it should be correct now ;) Oh I added chrome beta back in as well as they keep pushing betas out every now and then
[Asus Transformer TF700] elfaure:
And I added Firefox beta and Dolphin beta. They'll be in the next final release.
[Asus Transformer TF700] becomingx:
I don't understand what the additional conditional is supposed to do. Lil' help?
[Asus Transformer TF700] elfaure:
Just checks if there's a FF mountpoint over its cache before umounting it, just like for the rest of the browsers, so you neither have to silence or redirect the umount errors generated when you try to umount something not already mounted, since now they don't occur now. Based on the main block method I used to eliminate the umount errors and remove the "complicated error trapping" I attempted when you commented "Cool! I like it. Never used the mountpoint command before, maybe I'll adopt it". I figured I would do the same for FF (and FF beta I added) as the rest of the browsers. No sense in (re)mounting what's already mounted. It really only applies for when run from the terminal or SManager more than once in a single boot session (running script then umounting some but not all of the mounts then running script again). Mainly for dev really, but I feel its a nice check to have nonetheless.
[Asus Transformer TF700] becomingx:
Gotcha. Shouldn't the line be more like this though?

if [ ! -z "$FIREFOX_CACHE_DIR" ] && [ -d $FIREFOX_CACHE_DIR ] && ! mountpoint -q $FIREFOX_CACHE_DIR; then
[Asus Transformer TF700] elfaure:
Honestly, I don't have the experience to answer that question. If you think its better, then it is and I'll use it. But the conditional test for non-equality works and structurally matches the other two conditional checks more closely using the test command [. It also demonstrates the use of test with an equality or non-equality, which is not well documented in the man pages. I felt it was a useful code snippet for other coders to see in action.

Where this is needed is when you load the script, then run the umount_all script which then fails to umount the cache for any active browser sessions. Errors with "device or resouce busy" I believe, and can't umount the active browser cache because its in use and contains data. Then if you run the script again, a duplicate mountpoint for the active browser is created. Repeat the process and a third mountpoint is created. This additional conditional expression eliminates any duplicate mountpoints from being created in this case.
[Asus Transformer TF700] becomingx:
Fair enough, and I really like the idea of doing the check, but the statement doesn't make any sense. It's comparing the string `mountpoint' to the value of $FIREFOX_CACHE_DIR.

If you want to use the mountpoint command to check if the mount already exists you need to give it the path as an argument. I guess I'm a bit confused because you used it (almost) properly back here.

I say almost because we actually need to negate the return value using a bang (!) preceding the command. If the passed path is a mount point, mountpoint will exit with code 0, which, in this case, is (counterintuitively) true. We want it to be false, i.e. we proceed if it's not a mount point.
[Asus Transformer TF700] elfaure:
If you run the code I presented, it works. I tested it. If FF cache is mounted, it doesn't remount it. If not, it mounts it. Somehow this works as intended without the path. But the logic is reversed from my code. Read next.

Regarding where I almost used it correctly, you are incorrect. You almost had me sold and I bought it, but I just erased a long post after realizing it was correct. If you look closely, notice there is a nested if loop check just for the umount to proceed if its a mountpoint, otherwise the rm and mount still proceed outside of that loop. And if its a mountpoint (meaning its already mounted), then umount it, otherwise don't. This is correct. Firefox currently does NOT have a second loop, so the logic would be reversed (not a mountpoint) and the umount would fail, but the rm and mount would succeed. That's why I added the second loop. There is a conflict of interest if its already mounted, because we still want to rm and mount for both cases of mountpoint, just not umount both cases. There needs to be two loops to make it work for both cases.
[Asus Transformer TF700] elfaure:
Running a stock Chrome browser with a few about:flags tweaks on Linux Mint 15 Mate 64, and it just smokes on my old Dell 690. This is my slow PC, and I just installed a dual boot XP/Linux and now its browser is faster on Linux than the same browser is in Windows on my fast T3500, which I dare not tweak because its my CAD station. Wow. When your Windows PC gets too slow for you to bare, just install Linux and it feels like a snappy new PC again. Impressive, especially on old hardware.:good:
[Asus Transformer TF700] becomingx:
I've run it and it always umount's, rm's, and mount's. This code: [ mountpoint != "$FIREFOX_CACHE_DIR" ] compares two strings for inequality, the command `mountpoint' is never invoked. If it does somehow work for you then there is some other reason.

Ah, you are right, the comment lines and lack of indentation cluttered up the code a bit so I didn't look close enough. Mea culpa. However, please stop calling `if' blocks "loops", it's confusing (and incorrect). :confused: A better name would be "conditional blocks" or just "if blocks".

OK, in looking at the code here closer, I see what you're trying to do, but if the `umount' command fails (resource busy or whatever), the code will still create another mount. You've got the error checking code there though (commented-out), but I would just have it return early from the function rather than exiting the whole script.
[Asus Transformer TF700] elfaure:
I think the reason it worked for me is when mounting an already mounted FF cache, a duplicate mountpoint is not created. This is not true for all browsers. If you do this with Chrome (and have it running), it will create a duplicate mountpoint and that's what I was looking for to qualify it. Maybe this only happens if the browser is active in a session. I didn't realize this until now, and I never had FF active when testing the script. Chrome is always active since its the default browser I use.

Ok, I will not refer to if-then-else (elif) as a loop any more if it technically incorrect, but I've always called it a loop since GW Basic and there are incorrect references to this being called a loop all over the internet. It may take me awhile to break this habit. I think what you are saying is its not like for-do-done which IS technically a loop and even if the if-then conditional is used against a list variable, its still not technically a loop. Got it. Thanks for the clarification. If its confusing to you, then it would confuse other pedantic programmers too.

I know it would be easier to just say if its not mounted, then do it all and if it is mounted then do nothing, but that doesn't satisfy the need to write conditional code that runs error-free in all conditions. Silencing std errors or sending them off to /dev/null (bit bucket) or equivalently 2>&- is not the way to write good code (in my opinion) - the errors are there for a reason. Its just like looking the other way and pretending they didn't happen. Its only a mask for a problem, not a solution. They should either be eliminated by alternative code construct or trapped/captured to the terminal (undesirable here, could confuse the user) or an stderr file (worthless here as the typical user wouldn't even look at the file if the mounts were created) whenever possible. That's the only reason I am introducing the mountpoint check for umount and fighting with it to make it work for all browsers.

I can take it from here, even FF. Let me work it out and post the proposed final construct, then you can qualify it after I functionally test it. Testing it for function doesn't qualify the code for correctness as I am finding out.
[Asus Transformer TF700] becomingx:
This makes sense. The umount command will succeed and a new mount is created, so no duplicates there.

Yeah, if a mount point is in use, the system will deny the unmount. Using some combination of `-f' (force) and `-l' (lazy) flags can help, but even if they're available with the Android umount command, we wouldn't want to use them in this case.

Weird. A loop by its very definition is something that repeats, if/then/else blocks all by themselves don't. :silly:

No prob. Not trying to be the grammar police, but in this case it does make it unnecessarily difficult to follow along.

Your first statement seems right though: if not mounted, then mount; if already mounted, then there's nothing that needs to be done ... no?

The only command that might fail under normal conditions in the rm(1) call, and we can safely ignore that. Using mountpoint(8) to check if we're already mounted gets rid of errors from umount(8). If the mount(8) call fails then either the script isn't being run as root, or we've got much bigger problems. And that first part of that can easily be handled with a call to id(1).

You're right on with your thinking, just need to get it from thought to code. :)

:good:
[Asus Transformer TF700] _that:
well, in BASIC the following *is* a loop using "if" ... and goto :)

10 x = 1
20 print x
30 x = x + 1
40 if x <= 10 then goto 20

Forget this immediately, it's good that these times are over.

As a pedantic programmer, I can say that it doesn't confuse me at all if you say "if loop", instead I immediately know that you don't know what you are talking about. :)

In general, I agree. But note that sometimes it may be required to immediately try something and then handle the failure: if you expect other processes to change the result of what you are checking, while your code is running. If you want to know more, google "race condition".

:) This is something that comes only with experience. At first, you are happy that your code does what you intended (because getting that far was hard enough), but you don't notice it only *appears* to work. Experienced programmers test their assumptions and try to break their code in various ways and check if it fails in the correct way. :)
[Asus Transformer TF700] Kico. St:
works on cm10.1 ?
[Asus Transformer TF700] sbdags:
Technically it should as long as it has init.d support which of course it does.
[Asus Transformer TF700] dasunsrule32:
http://xdaforums.com/showpost.php?p=43148185&postcount=2259
[Asus Transformer TF700] imzzz:
I've run the script in script manager and I get the "script run successfully" message, with a list of my browsers. But when i run from boot, it doesn't appear to be working.

I've ran the mount | grep tmpfs command in terminal and my apks are not listed. The script does not appear to run at boot, I've highlighted the two icons in script manager. My first time using script manager for anything. Any ideas? Thanks in advance
[Asus Transformer TF700] elfaure:
Script Manger: If you are still on 4.1.1 it should work at boot in script manager (a few have reported it not working). If you are on 4.2.1 then it is known to not work at boot and you must use the alternate method.

Alternative: Go to the first post in this thread, and down near the file attachment at the bottom is a link to "init.d method", which is the preferred 4.1.1 and the only 4.2.1 method for loading the script at boot.

*****************************************************

If this is the only script you need to run as root at boot, and you don't want to setup the full init.d method, a quick and dirty hack is to simply rename the script to "install-recovery.sh", copy it into /etc (/system/etc), and make it executable (cd /etc; chmod 755 install-recovery.sh). Hope this resolves it for you. :)
[Asus Transformer TF700] sbdags:
New Firefox beta added to script as follows:

FIREFOX_BETA_CACHE_DIR="$(ls -d /data/data/org.mozilla.firefox_beta/files/mozilla/*.default/Cache 2>/dev/null)"
if [ ! -z "$FIREFOX_BETA_CACHE_DIR" ] && [ "$FIREFOX_BETA_CACHE_DIR" != "." ] && [ "$FIREFOX_BETA_CACHE_DIR" != "/" ] && [ -d $FIREFOX_BETA_CACHE_DIR ];
then
umount $FIREFOX_BETA_CACHE_DIR 2>&-
rm -rf $FIREFOX_BETA_CACHE_DIR/* 2>&-
mount -t tmpfs -o size=50m firefox_beta_cache $FIREFOX_BETA_CACHE_DIR
fi
unset FIREFOX_BETA_CACHE_DIR
[Asus Transformer TF700] imzzz:
Cheers. Got it working using the second method. If I decide later to run other scripts at boot can i simply delete the "install-recovery.sh" file. Got a big boost in speed in the stock browser, have others got similar boosts in dolphin?
[Asus Transformer TF700] elfaure:
Yes, this is correct. Just delete it and/or replace it anytime you wish.

The script should boost the performance for any browser (in the list) cached to tmpfs RAM, including stock, Chrome, Firefox, Boat, and Dolphin.
[Asus Transformer TF700] dgjl:
Can't seem to get ths to work at all with 4.3 (CM10.2) - any ideas? It might be a script manager issue as that's the method I've used and it doesn't seem to work quite the same way when I try it with 4.3, that is, I don't get the script appear in the window after running it, rather I get .9999 (or something like that) in a box in the top left and an empty black space where the script would usually appear. The right icons do appear next to the script in the SM file list though... Any ideas?

SOLVED
[Asus Transformer TF700] FooFighter312:
Please share how you solved it, I'm having the same problem
[Asus Transformer TF700] RedSkyRoad:
Please share :)

Sent from my ASUS Transformer Pad TF700T
[Asus Transformer TF700] inkogneetoe:
Caution...noob alert!

I've a tf700 4.2.1 rooted. Smanager and b2ram script downloaded......what next? How do I use smanager to get this script to run?
[Asus Transformer TF700] inkogneetoe:
Anyone?
[Asus Transformer TF700] RedSkyRoad:
It's much easier just to remove all the extensions from the file and put it in /system/etc/Init.d folder, then set permissions and reboot
[Asus Transformer TF700] inkogneetoe:
Thanks but I don't seem to have an init.d folder in that directory:confused:
[Asus Transformer TF700] sbdags:
You would need to be unlocked with a custom kernel to make use of init.d
[Asus Transformer TF700] _that:
...or hook into install-recovery.sh.
[Asus Transformer TF700] inkogneetoe:
:(

:)

Can you translate to English please? :p
[Asus Transformer TF700] _that:
Can you read the thread please? :)

(hint: try the search function)
[Asus Transformer TF700] inkogneetoe:
No fair :D
[Asus Transformer TF700] inkogneetoe:
Done......chrome works now....sooooo fast. Thanks all! I know this way is regarded as a dirty hack. can s manager be used to install cleanly at init.d without unlocking?
[Asus Transformer TF700] Christoff_:
Hey guys, little help. I'm on a tf700 with 4.2.1 and cromi-x. Rooted, etc. Using google chrome as my browser. I understand this is the browser2ram replacement. Can someone provide me with a dummy step by step guide on how to get this going on 4.2.1? I'm a bit new to android
[Asus Transformer TF700] sbdags:
It's already included for you in cromi-x. ;)
[Asus Transformer TF700] Christoff_:
Ah, thanks man! Didn't realize that.

I ran the one from your thread :p

http://xdaforums.com/showthread.php?t=2223492

I realize it's an old one. Is there much of a reason to upgrade to the new one?

http://xdaforums.com/showthread.php?t=2425383

My wifi is a bit limited and I'm away from my computer for a while and this is all I have, don't want to mess anything up :) Because I see you recommend doing a full wipe. Or is that only if you're coming from a completely different rom?

Is it easy to upgrade to your new version here in my situation? Sorry for all the questions but android and all this is pretty foreign to me. I was only able to do it with step by step help in this thread I posted

http://xdaforums.com/showthread.php?t=2265458
[Asus Transformer TF700] sbdags:
Yes it should be pretty straight forward. Going from 4.7 to 5.2 should just flash over the top as incremental base updates. If you do have issues you may need to wipe.
[Asus Transformer TF700] Christoff_:
Got a quick easy step by step for me? :p

What are the big changes? Should I just wait until I'm home in 5 months?
[Asus Transformer TF700] sbdags:
Well you just flash it over the top! What could be easier?

Hundreds of changes are all in the first post of the CROMi-X thread ;)
[Asus Transformer TF700] whatsisnametake2:
cm11

hi folks,

this mod ok on C11 M5 with dolphin? it seems to be alright. i've used the scriptmanager method to run at boot. in terminal when i enter "mount |grep tmpfs" i get the correct response showing the tunnybrowser cache had been created. in dolphin i have cache to sd turned off. what about dolphin pack being activated?
[Asus Transformer TF700] PanicMan:
Did it with the busybox hack method on my wookie prime.

Hat to adjust the firefox cache path, as it seems it had changed.

Seems to work, but I have two entries for every browser, is this correct?

Edit: it seems something is allready running init.d at startup, so i removed the install-recovery.sh script and now everything is fine! thanks for it!

Gesendet von meinem Transformer Prime TF201 mit Tapatalk
[Asus Transformer TF700] elfaure:
System Tuner>User Apps (or if Chrome System Apps)>Find and click on the app in the list to highlight it>details

Also, I just launch the browser then "ps" from a terminal, look thru the list, and find the browser by name description (if its close to the program name; most are - dolphin was not)
[Asus Transformer TF700] dgjl:
Will the upgrade over write the former script or do I need to remove that somehow?
[Asus Transformer TF700] elfaure:
How are you currently loading the former script? However you are doing that, do it for the upgrade instead. You don't want to run them both or you may have some double mounts created but it won't hurt anything if you do.

If you loaded the previous version using the terminal just reboot and load the new one instead

If you are using an init.d script just have it call the new one instead

If you are using Script Manager to load the previous one, undo the steps which you took to load it at boot and run it as root and redo for new version:

1. Open SManager and highlight the script

2. Uncheck both "su" and "boot"

3. Run the script in SManger to get the new settings to stick

4. Verify the settings by backing out and NOT seeing the icons for su and boot next to the script name in the list (if you have multiple scripts)

5. Do the same steps 1-4 for the new script except check "su" and "boot" and SEE the icons set
[Asus Transformer TF700] elfaure:
Please request your favorite browser to add

I will update this once more and want users to request browsers to add. I think 10-12 will be plenty for 99.99% of users. I will also spell “acknowledgements” correctly.

I am already planning to add:

Dophin mini

Dolphin HD (can someone please tell me what the apk file is named for this program - its not compatable so I can't install it)

*******************************************************

[Edit] Are dolphin and dolphin HD synonymous or are they two different apps???

*******************************************************

Baidu

Adrenaline (this is fast! even without a mount)

"Your browser"

Thks
[Asus Transformer TF700] elfaure:
Want FAST? - Check this out!

It wouldn't surprise me if this has been done before but I have never heard of it. If it hasn't then I make claim to this idea 05/15/2013.

While working on this script and browsing /data/data and noticing that most apps had a /cache directory the thought just popped into my head "what else can I RAM cache to speed this thing up?" Well I just thought I'd give this a try, if it works well for browsers why not launchers and/or system ui's, and it seems to be a real winner. I've got to test drive the second one, it might be a little video glitchy but I can live with it for the performance gain. Between the browser script and this trick my device feels 10x faster.

mount -t tmpfs -o size=200m launcher_cache /data/data/com.android.launcher/cache

mount -t tmpfs -o size=200m systemui_cache /data/data/com.android.systemui/cache

Put your seat belt on and launch a few apps.
[Asus Transformer TF700] _that:
How much data do you see these two apps write to their cache? I find only two files for each, both are tiny (10 to 12 kB, and a few hundred bytes), and quite old, so they are not written regularly.
[Asus Transformer TF700] elfaure:
That was my observation too but you can't deny the performance gain. Like another browser script user said it *seems* to increase the entire IO performance significantly making the device feel more snappy. Apps launch faster and screens switch faster. Nothing here substantiated, measured, or deterministic but its obvious to me it works. Just give it a test drive and you'll be signing the papers.

I just randomly chose 200MB as the cache size to test the theory. That could easily be way too large but since its dynamic it really doesn't matter as there is no downside to a larger cache.
[Asus Transformer TF700] berndblb:
Damn! That sounds tempting! You gonna force me to learn understanding and writing scripts, are you now?? LOL

Great work! Keep going!
[Asus Transformer TF700] elfaure:
Bump. Can someone please just try it and confirm I'm not imagining the boost? Its only two lines of code to paste into the terminal.