Log in

View Full Version : Free up your memory and optimize your Internet access speed-relocate the PIE/NF cache


Menneisyys
09-03-2005, 09:42 AM
Decent Pocket PC browsers have a so-called 'cache' of the downloaded Web resources (Web pages, images, other files) on the local device so that subsequent requests for the same resources (if they haven't changed on the Web server) may result in quickly reloading them from the local file system instead of getting them from the Web server again. This may result in great bandwidth/time savings.

Browsers that do have a local cache are Pocket Internet Explorer (PIE for short) and NetFront (NF) from version 3.2. (Note that you should switch off local caching in pre-3.2 NF versions entirely because it's buggy and generally useless for non-offline browsing purposes (http://www.pocketpcthoughts.com/index.php?action=expand,41008&/netfront_3.2_english_finally_released.htm).) Note that Thunderhawk, Minimo and Opera Mini (http://www.firstloox.org//forums/showthread.php?p=38051) don't use any kind of local cache (http://www.pocketpcthoughts.com/index.php?action=expand,42026&/pocket_pc_web_browsers_-_the_complete_roundup.htm) - if you only use them, as opposed to PIE/NF, you don't need to read this article.

What do you gain by relocating the cache?

First, precious RAM memory , which is extremely important with devices with (comparatively) less memory (even including 64M RAM devices). You may gain a lot of memory with the relocation; especially on WM2003SE devices, where the maximal size of the cache is virtually unlimited in practice.

Second, generic (not just in PIE, but also in everything) speed and responsiveness. The more files in RAM (independent of their size), the more the Pocket PC/Windows Mobile operating system slows down (http://www.pocketpcthoughts.com/forums/viewtopic.php?t=36376). Therefore, it's the best, also system speed/responsiveness-wise, to try to move out files out of RAM - including cache files.

How come the cache speed can actually be faster when relocated to a slow memory card??

Many people think the cache of PIE or NF should be in the main RAM for optimal performance because the built-in RAM is about two orders of magnitude faster than flash ROM-based storage cards. This is true if you don't fine-tune your memory card(s) for optimal performance, as can be seen for example here (http://www.pocketpcthoughts.com/forums/viewtopic.php?t=36376). (Those tests were done with unoptimized memory cards.) (Note that the same stands for built-in File Stores (where applicable): they are very slow to write to and, therefore, slow down the browsing considerably if you relocate the PIE cache in there. Therefore, you should never try to relocate your PIE/NF cache to any kind of built-in Flash ROM (File Store). Not just because it'll be really slow, but also you can actually kill your File Store with devices that have faulty File Store controllers like the iPAQ rx3715 (http://www.pocketpcthoughts.com/forums/viewtopic.php?t=39971)).

If you, however, do optimize your cards (note that you can't optimize built-in File Stores - they will always remain extremely slow!), they can actually be better for storing the cache files than the RAM because it's not the RAM write speed that counts when creating and storing a lot of cache files but also additional, RAM-only overheads like the Object Store management overhead, which can very easily render the RAM access speed advantage non-existing if you need to create tons of new files. Then, the Object Store management overhead may even result in slower operation than with flash cards. Note that this only refers to pages that have dozens or even hundreds of resources. Pages that don't contain any related resources or if you always browse without displaying images, RAM-based cache will always be at least 30-60% faster than a relocated one because, then, it's only the pure transfer (write) speed that counts and not the overhead caused by creating tons of files. That is, if you always switch off images while browsing the Web, you will not encounter any PIE speed increase if you switch to using external cards. You will, however, notice overall operating system speed increase even then because of the fewer files in RAM. There is a tradeoff here - you need to decide yourself.

For example, some benchmark results with optimized cards, based on this article (http://pocketpcmag.com/forum/topic.asp?TOPIC_ID=17921):

- the same iPAQ 2210 that loaded the same test Web page (full of different image files that were then stored in the cache) in 1:25; it spent 1:27 in doing the same while storing the files on a hi-speed Ridata card and 1:40 while storing the files on a cheapo SanDisk card.
- the same Pocket Loox 720 that loaded this test page in 1:34 while using the RAM as the cache storage only spent 1:23 while using the Ridata. On the other hand, it spent 4:40 with an unoptimized, low-end Kingston card. With the same Kingston card, but with optimized file system, this time has decreased to 1:30.

It can clearly be seen that if you optimize your cards, even the cheapest and slowest ones (mostly Kingston, but also low-end SanDisk cards) can be used for storing the PIE / NF cache with even better speed than the built-in RAM.

How do you optimize your storage card speed?

Please read this article (http://pocketpcmag.com/forum/topic.asp?TOPIC_ID=17921) - it contains all the necessary information. Please also note that you should not try relocating your cache without optimizing your card(s) - this may result in slowdowns of even 3-4 times!

After optimizing your storage card speed, how do you relocate the PIE/NF cache to the card?

(Please note that this section will only contain PIE-related relocation techniques. Therefore, if you want to relocate your NF 3.2 cache, skip the rest of this section and go straight to section Relocate the NF 3.2 cache. You, however, may still want to read the following subsection on choosing the right Registry Editor because you will need one for relocating the NF 3.2 cache.)

Both PIE and NF (I only refer to version 3.2 of NF because, as has already been pointed out, older versions have a totally faulty cache engine and, therefore, their caching should be disabled unless you want to explicitly browse them) store the path of the cache in the Registry. You can freely overwrite this value with both a so-called 'Registry Editor' or, with PIE, with a specialized program. The former is better in that you don't end up installing another system tweaker application (particularly if you already have a Registry editor on your PPC); the latter is a bit safer, especially for non-Pocket PC-gurus.

If you aren't afraid of manually editing the registry - in most cases, it's much more instructive - and prefer it to using pre-made programs, grab a registry editor (http://pocketpcmag.com/forum/topic.asp?TOPIC_ID=16508) (if you don't already have one) and manually edit [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Cache] .

1. Make a cache directory on your (optimized) memory card. Let's call it, for example, 'cache' (its name is really irrevelant).
2. go to [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders]
3. click Cache in the pane below (if you use any registry editor except Total Commander 2.0); it's highlighted in the following screenshot:

http://www.winmobiletech.com/092005RelocateCacheTutorial/PIECacheRelocationReg-1.gif.png

4. enter the new path instead of the old (\Windows\Profiles\guest\Temporary Internet Files); for example, \CF-Card\cache:

http://www.winmobiletech.com/092005RelocateCacheTutorial/PIECacheRelocationReg-2.gif.png

5. now, the updated value should be shown in the Cache value:

http://www.winmobiletech.com/092005RelocateCacheTutorial/PIECacheRelocationReg-3.gif.png

(Please note that you don't need to reset your device after modifying this value, contrary to what some people say. The same stands for stand-alone cache path modification utilities - they reset the PPC totally unnecessarily.)

If you go the safer/easier way (instead of manually editing the Registry), you have several choices:

Tweaks2k2.NET (http://www.tweaks2k2.com)

Go to Tweaks/Internet Tricks and, on the PIE tab, choose the right storage card in the 'Temp. Files saved in' drop-down list:

http://www.winmobiletech.com/092005RelocateCacheTutorial/Tw2k2PIERelocation.gif.png

SKTools (http://s-k-tools.com/)

SKTools is an all-in-one tool with extremely good price/performance ratio for the Pocket PC (http://pocketpcmag.com/forum/topic.asp?TOPIC_ID=17596). I really recommend it - not only for relocating the cache, but also for a lot of other tasks (for example, optimizing your storage cards.)

Click System Tweaks:

http://www.winmobiletech.com/092005RelocateCacheTutorial/SKToolsPIECacheRelocation-1.gif.png

and, after clicking 'PIE cache location', choose the right directory by clicking the ... button in the top right corner and choose the target. After this, the new path will already be visible:

http://www.winmobiletech.com/092005RelocateCacheTutorial/SKToolsPIECacheRelocation-2.gif.png

After this, just click OK and you may exit the application.

MemMaid (http://www.handango.com/brainstore/PlatformProductDetail.jsp?siteId=311&jid=6347C424AX1786351C81CB5AE9EX729F&platformId=2&productType=2&catalog=0&sectionId=0&productId=123995)

Go to the fourth tab (Memory Tweaks), choose the right storage card from the IE Cache Folder drop-down list and click Apply (which will be followed by a reset):

http://www.winmobiletech.com/092005RelocateCacheTutorial/MemMaidPIECache.gif.png

A bit of warning

Please note that, with PIE, you should never remove the memory card that has the cache on it during you browse the net (or just start PIE - PIE will recreate the cache directory structure when it's started). This is because if PIE doesn't find the directory that your card is mapped (mounted) into the file system (\SD Card, \Storage Card, \SD-MMCard, \CF Card etc.) because you've removed the card, it just creates one. However, when you reinsert your storage card in the PDA, the operating system won't be able to mount the storage card under the same directory name because it already exists. Therefore, it'll append a number '2' to the directory name; for example, it becomes \CF Card2 . This also means 1, all your existing links will be dead 2, the cache will physically also be relocated to the RAM and will, therefore, decrease the overall responsiveness of your PDA and also waste precious RAM memory.

Note that this is also explained in my article here (http://www.firstloox.org//forums/showthread.php?t=3483) and here (http://pocketpcmag.com/forum/topic.asp?TOPIC_ID=17734), referring to relocating the Messaging/Pocket Inbox attachments to a storage card. It describes exactly the same problems (with the additional problem of the Messaging Today plug-in).

As an example of such a problematic re-mapping, see the following screenshot. The two directories (one is a bogus directory created by PIE, the other is the real memory card mounted) in the root directory are highlighted:

http://www.winmobiletech.com/092005RelocateCacheTutorial/DoubledCFCardDirs.gif.png

If you pay special attention to the icons of the two directories, you'll notice that \CF Card is a non-mounted (that is, RAM) directory because it doesn't have the 'memory card' icon in front of its name, while \CF Card2 is where the real CF card is mounted - this is why it has the 'memory card' icon in front of it.

NF doesn't cause problems like this - that is, you can safely remove the card containing the NF cache during using the application, it won't create a bogus directory resulting in remapping problems.

Relocate the NF 3.2 cache

You can only do this with a registry editor. Navigate to HKEY_CURRENT_USER\Software\access.co.jp\NetFront32\BrowserPref and edit
L2CacheDir (highlighted below) exactly the same way as with the PIE registry entry:

http://www.winmobiletech.com/092005RelocateCacheTutorial/NetfrontCacheRelocate.gif.png

http://www.winmobiletech.com/092005RelocateCacheTutorial/NetfrontCacheRelocate-2.gif.png

That's all, folks :) !

Recommended reading

Please note that I've written tons of other 'relocate this and that' articles (in addition to other genuine and unmatched roundups, tips and tricks). You may really want to read them at either the Pocket PC Magazine Tips forum (http://pocketpcmag.com/forum/forum.asp?FORUM_ID=4) or at Windows Mobile Technology (http://www.winmobiletech.com).

Ward
09-05-2005, 07:22 AM
You mean PIE actually caches!!? Since when??


:wink:

ctitanic
09-05-2005, 09:32 PM
You mean PIE actually caches!!? Since when??


:wink:

As far as I can remember since Pocket PC 2000 and HPC2000.

bvkeen
09-05-2005, 10:36 PM
This is an absolutely superb writeup, Menneisyys!

But, to show you how extremely dense I can be, let me ask if doing this really gives me any gain over just using MemMaid or SkTools to periodically clean out my temporary internet folders? I have a Sandisk 1GB card that I got in February when I got my Dell (Dell had a special on it), anit seems to be reasonably fast, but I haven't benched it. But, my recollection is that I tried moving the PIE temp folder to it a few months ago (using Tweaks2k) and it slowed PIE to a crawl. But I'm willing to experiment some more if it'll really make a performance difference.

Thank you for your great articles.

Menneisyys
09-06-2005, 11:45 AM
let me ask if doing this really gives me any gain over just using MemMaid or SkTools to periodically clean out my temporary internet folders?


Having a (large) page cache may be advantageous upon subsequent requests because you'll have a much higher chance to be able to return the given resources from the local file system. Therefore, having a local cache is almost always better than not having one.

(Deleting the cache will not necessarily result in much higher traffic, however, because most dynamic HTML pages don't have a timestamp so they will always be reloaded. Images are, on the other hand, are almost always static, so, they can be retrieved from the local cache if you revisit a page.)


I have a Sandisk 1GB card that I got in February when I got my Dell (Dell had a special on it), anit seems to be reasonably fast, but I haven't benched it. But, my recollection is that I tried moving the PIE temp folder to it a few months ago (using Tweaks2k) and it slowed PIE to a crawl. But I'm willing to experiment some more if it'll really make a performance difference.


Yes, I'd be also interested in your benchmarking results of the different file system (FAT16/32/cluster size/FAT backup existence) configurations.

Thank you for your great articles.

Thanks. :)

bvkeen
09-06-2005, 01:28 PM
Thanks Menneisyys.

I used SKTools to move the cache, and there seems to be a speed improvement (it certainly is not slower). I didn't do a formal benchmark, and my SD card has Way too much info on it for me to mess with various disk format options, but I am satisfied with the move and appreciate this article and many of your others that have to do with relocation.

Take care,
Bruce

murph
09-07-2005, 04:43 PM
great, informative article. i tried moving the cache before on my i730 but i dont think it worked. i will give this another try.

PS i love those be-a-utiful VGA screenshots.

Menneisyys
09-07-2005, 06:40 PM
I've got a mail, which, together with my answer, may be of interest to the general public:

"Hi Menneisyys,

1) I love, love your articles. In fact, I have learned more in the past 6 weeks from reading your material than in the past 16 months of Samsung SPH-I700 ownership. Thank you!

2) My question is simple, and I apologize in advance if it is already answered (or if I am just not 'getting' it) Concerning relocating the NetFront ver 3.2 cache - if I simply install the app on my SD card, will all the advantage of relocating the cache from main memory to the SD card be realized? Wouldn't this in fact be the simple, optimal way of achieving this? Is there any advantage to installing the app to main memory followed by relocating the cache?

Again, if I am asking the obvious, please excuse, I didn't see this particular issue listed.

Thanks again for invaluable (priceless) advice.

Sincerely,

Matthew"

Indeed I've forgotten to emphasize that NetFront, by default, stores the cache on the same (physical) drive (a Flash ROM card, the built-in RAM or the File Store or, BIS (Built-In Storage) in Dell Axim users' parlance) where it is installed to.

That is, if you install NetFront in the File Store, loading a new page will almost slow it to a crawl (because of the very low file creation/file write speed of the File Store). No wonder a lot of people that have installed NetFront into the File Store/BIS complain of its speed (http://www.aximsite.com/boards/showthread.php?t=95858).

In cases like this, you will really want to relocate the NetFront cache. This operation, incidentally, will also be supported in forthcoming Tweaks2k2 versions (http://discussion.brighthand.com/showthread.php?s=&postid=777469).

Again, it's starting with version 3.2 that the NetFront cache can be relocated.

I'd also add that the default maximal cache size is 1 Mbytes in NetFront. You may want to override this in Tools/Browser Setting/General/Cache group by letting NetFront use a much bigger cache to raise hit probability.

ctitanic
09-07-2005, 06:50 PM
In cases like this, you will really want to relocate the NetFront cache. This operation, incidentally, will also be supported in forthcoming Tweaks2k2 versions (http://discussion.brighthand.com/showthread.php?s=&postid=777469).

It's included in version 3.11 released yesterday! Also included support for version 3.3 of NetFront. :devilboy:

schmenge
11-23-2005, 08:19 PM
I've poured through this, and the other fine write-up on optimizing cards, but I must be missing something (simple I hope) stupid. With both cards IE will start fine and then after a period of time (sometimes quickly, other times not), I will start IE, but as soon as I try and go to a site IE will shut itself down. The only way to fix this is a soft reset.

If I put the cache in built-in memory or RAM all is fine, it is only when I direct the cache to a card. Running WM 2003, on an AudioVox PPC 4100. My current card is a Toshiba and the other card I have tried is a Sans.

Any ideas?

Menneisyys
11-23-2005, 09:10 PM
I've poured through this, and the other fine write-up on optimizing cards, but I must be missing something (simple I hope) stupid. With both cards IE will start fine and then after a period of time (sometimes quickly, other times not), I will start IE, but as soon as I try and go to a site IE will shut itself down. The only way to fix this is a soft reset.

If I put the cache in built-in memory or RAM all is fine, it is only when I direct the cache to a card. Running WM 2003, on an AudioVox PPC 4100. My current card is a Toshiba and the other card I have tried is a Sans.

Any ideas?

Did you try optimizing the cards? It may help (or not). The vast majority of people that relocated the cache have no problems at all.

schmenge
11-23-2005, 09:17 PM
I did not try testing various speeds via a card reader as I do not have a card reader. But those are cheap and if that step will help I can pick one up. I am formatted at fat16 and 512kb on my current card.

Menneisyys
11-23-2005, 09:24 PM
I did not try testing various speeds via a card reader as I do not have a card reader. But those are cheap and if that step will help I can pick one up. I am formatted at fat16 and 512kb on my current card.

They are not a necessity in reformatting your cards - you can just reformat the cards in your PDA.

I think it's the cards that are causing the problem - for example, they are using a very slow file system and/or are heavily fragmented. A quick reformat can never cause any harm to a memory card.

schmenge
11-23-2005, 11:29 PM
In the case of the Toshiba card, which I am currently using, the card is brand new (like 3 days old) and I did format with my PPC using Pocket Mechanic. Same with the old card (which I also reformatted before moving the cache to the card).

Could it have anything to do with the cahce size? CacheLimit dword is set to 8000.

Menneisyys
11-24-2005, 06:41 AM
In the case of the Toshiba card, which I am currently using, the card is brand new (like 3 days old) and I did format with my PPC using Pocket Mechanic. Same with the old card (which I also reformatted before moving the cache to the card).


Then, I don't really know what the problem might be.

Could it have anything to do with the cahce size? CacheLimit dword is set to 8000.

Nope.

schmenge
11-24-2005, 01:30 PM
Oh well, thanks for the replies (and other interesting posts). At least I'm not slapping myself on the forehead over something simple. :D

dazz
12-01-2005, 05:27 AM
I had the exact same problem with the PIE cache on my card. I had to switch it back to ROM. I also tried doing this with Netfront and had the same problem. Once back in ROM it worked fine.