silversolver 849 Posted January 14, 2020 Share Posted January 14, 2020 23 hours ago, Chris said: @silversolver Have you done anything ( custom OS ) any other tweaks to keep your Droid 4 passable these few years? ... I gave up on mine a while back as it started to slow down Much. :) I installed the SafeStrap version of TWRP, then LineageOS (Android 7.1) and I also switch it from ZRAM (RAM compression via swap protocol) to true swap on the SD card at bootup. This can be automated but I haven't bothered. 1 Quote Link to post Share on other sites
ksal95 227 Posted January 14, 2020 Share Posted January 14, 2020 12 minutes ago, silversolver said: Much. 🙂 I installed the SafeStrap version of TWRP, then LineageOS (Android 7.1) and I also switch it from ZRAM (RAM compression via swap protocol) to true swap on the SD card at bootup. This can be automated but I haven't bothered. Ah safestrap, I'm glad the S4 I purchased was Loki patched, the people that didn't patch their S4 needed to use safe strap and could only flash TouchWiz ROMs, those poor souls! 1 Quote Link to post Share on other sites
Craig 1,435 Posted January 14, 2020 Share Posted January 14, 2020  15 minutes ago, silversolver said: and I also switch it from ZRAM (RAM compression via swap protocol) to true swap on the SD card at bootup Seems odd to disable zram on device with only 1GB ram trying to run nougat. Unless you're only opening one thing at a time or something, seems like it'd be much slower w/o zram. But the fact you're doing it manually so you are aware of the difference in behaviour I guess must mean you like it.  I was the opposite way (on PQ), zram wasnt implemented until lollipop, and without it, it was unusable; anything post kitkat seems unusable to me (with only 1GB) w/o zram. Quote Link to post Share on other sites
silversolver 849 Posted January 15, 2020 Author Share Posted January 15, 2020 6 hours ago, Craig said:  Seems odd to disable zram on device with only 1GB ram trying to run nougat. Unless you're only opening one thing at a time or something, seems like it'd be much slower w/o zram. But the fact you're doing it manually so you are aware of the difference in behaviour I guess must mean you like it.  I was the opposite way (on PQ), zram wasnt implemented until lollipop, and without it, it was unusable; anything post kitkat seems unusable to me (with only 1GB) w/o zram. Perhaps I wasn't clear. ZRAM creates a virtual swapspace (used by the kernel as extra RAM) which is backed by system RAM, and stuff going into it is compressed to save space. I created a TRUE swapspace as a file on my SD card and use that instead of ZRAM. A 256MB swap file gives about the same amount of additional usable RAM but without the additional CPU overhead of ZRAM (no compression, just I/O) and my phone is much more stable that way. I used to get random reboots every few days at most; I can't think of when I had one with a page file. One time I forgot and yanked the SD card; that predictably crashed it, but that's not random since I caused it. :) The performance is comparable as I have a fast SD card and using true swap instead of ZRAM leaves much more real RAM available. Using it now to type this. :) 1 Quote Link to post Share on other sites
Craig 1,435 Posted January 15, 2020 Share Posted January 15, 2020 (edited) Hehhehhe. I do think I understand zram. So when something wants to swap, it can swap in your case to SD, or in default case to internal storage. But with zram, when it wants to swap, it first swaps to zram. zram comes from memory, so way way way faster than sd or internal storage... except some cpu stuff compresses it... so it takes less space in memory than it would on disk, although takes a little cpu, and of course taking some of your real ram to make zram.  using swap on sdcard isnt faster than using swap on internal storage, in fact its slower. Edited January 15, 2020 by Craig i italized the word think, cuz i could be wrong Quote Link to post Share on other sites
EskeRahn 5,460 Posted January 15, 2020 Share Posted January 15, 2020 6 hours ago, silversolver said: I created a TRUE swapspace as a file on my SD card and use that instead of ZRAM. I would be a bit worried on using SD for SWAP, as an SD card got a limited number of writes. Not an extremely low number, but if the swap is needed, it is likely to be quite active. At the least is should be something to be very aware of when choosing the particular SD-card model to use. 1 Quote Link to post Share on other sites
david 929 Posted January 15, 2020 Share Posted January 15, 2020 3 hours ago, Craig said:  using swap on sdcard isnt faster than using swap on internal storage, in fact its slower. On my Relay 4G, my SD card is faster than my internal storage. I use an app called Link2SD (https://play.google.com/store/apps/details?id=com.buak.Link2SD&hl=en_US) to allow me to run apps and have them store their data on the SD card (in a special partition). I was worried about that slowing them down, but before I went through that transformation, I tested the storage speeds with another app and was pleasantly surprised that the SD card was faster. I'm sure that isn't the case in newer phones, but in older phones it can apparently be true. After utilizing Link2SD, not only did I free up space on my internal storage (which also makes it run faster), and not only could I install many more apps, but the apps I run off the SD card load faster than the ones on the internal storage. No idea if that would be the case with the Droid 4, though. 2 Quote Link to post Share on other sites
silversolver 849 Posted January 15, 2020 Author Share Posted January 15, 2020 4 hours ago, david said: On my Relay 4G, my SD card is faster than my internal storage. I use an app called Link2SD (https://play.google.com/store/apps/details?id=com.buak.Link2SD&hl=en_US) to allow me to run apps and have them store their data on the SD card (in a special partition). I was worried about that slowing them down, but before I went through that transformation, I tested the storage speeds with another app and was pleasantly surprised that the SD card was faster. I'm sure that isn't the case in newer phones, but in older phones it can apparently be true. After utilizing Link2SD, not only did I free up space on my internal storage (which also makes it run faster), and not only could I install many more apps, but the apps I run off the SD card load faster than the ones on the internal storage. No idea if that would be the case with the Droid 4, though. None of that was a factor in my decision-making process. I am aware of limited write cycles on SD, which is why I chose it; if I'm going to wear out a storage device, I'd rather it be the one that is easy to replace. :) I am aware that some people swap on internal storage, but I would never even consider that because of write durability. I do move the swap file around from time to time on the card to try not to burn out all the cells. Ultimately it's not a big deal to me either way. SD is relatively cheap. 1 Quote Link to post Share on other sites
david 929 Posted January 15, 2020 Share Posted January 15, 2020 1 hour ago, silversolver said: None of that was a factor in my decision-making process. I am aware of limited write cycles on SD, which is why I chose it; if I'm going to wear out a storage device, I'd rather it be the one that is easy to replace. :) I am aware that some people swap on internal storage, but I would never even consider that because of write durability. I do move the swap file around from time to time on the card to try not to burn out all the cells. Ultimately it's not a big deal to me either way. SD is relatively cheap. I think you may have replied to my post, but mean to reply to @EskeRahn? Quote Link to post Share on other sites
silversolver 849 Posted January 15, 2020 Author Share Posted January 15, 2020 3 hours ago, david said: I think you may have replied to my post, but mean to reply to @EskeRahn? I don't think so....? Quote Link to post Share on other sites
silversolver 849 Posted January 15, 2020 Author Share Posted January 15, 2020 13 hours ago, Craig said: Hehhehhe. I do think I understand zram. So when something wants to swap, it can swap in your case to SD, or in default case to internal storage. But with zram, when it wants to swap, it first swaps to zram. zram comes from memory, so way way way faster than sd or internal storage... except some cpu stuff compresses it... so it takes less space in memory than it would on disk, although takes a little cpu, and of course taking some of your real ram to make zram.  using swap on sdcard isnt faster than using swap on internal storage, in fact its slower. I only just saw this. Internal storage is essentially the internal SD. ZRAM uses RAM, not internal storage. Performance in my use case is comparable. The SD medium is definitely slower, but there's no CPU load and more real RAM available. The exact performance comparative between ZRAM and SD swap will depend on the use case and SD speed. My SD is fast and use case tends to have high CPU loads, so I get generally comparable performance, with the benefit being better stability. Quote Link to post Share on other sites
Craig 1,435 Posted January 15, 2020 Share Posted January 15, 2020 11 minutes ago, silversolver said: I only just saw this. Internal storage is essentially the internal SD. ZRAM uses RAM, not internal storage. Performance in my use case is comparable. The SD medium is definitely slower, but there's no CPU load and more real RAM available. There is no more real RAM available. You have 1GB of real ram no matter what. Using some of it as zram allows you to fit MORE into ram than you would without it (at the expense of cpu) as its basically compressing it on the fly and uncompressing it when you need it, but that is still way faster than using storage for swap. The only way not using zram is not faster is if you're not using all your ram. But with only 1GB and running Android 5 or later (which takes way more memory than 4), I find it very unlikely you can get away with running more than one or two apps in the leftover real ram. So without zram you end up swapping to disc a lot more, thus slower. In theory anyway. And very evident on PQ, also 1GB. Basically android 5 or later non usable w/o zram. That's why I was surprised you purposely not use it.  Quote Link to post Share on other sites
silversolver 849 Posted January 16, 2020 Author Share Posted January 16, 2020 9 hours ago, Craig said: There is no more real RAM available. You have 1GB of real ram no matter what. Using some of it as zram allows you to fit MORE into ram than you would without it (at the expense of cpu) as its basically compressing it on the fly and uncompressing it when you need it, but that is still way faster than using storage for swap. The only way not using zram is not faster is if you're not using all your ram. But with only 1GB and running Android 5 or later (which takes way more memory than 4), I find it very unlikely you can get away with running more than one or two apps in the leftover real ram. So without zram you end up swapping to disc a lot more, thus slower. In theory anyway. And very evident on PQ, also 1GB. Basically android 5 or later non usable w/o zram. That's why I was surprised you purposely not use it.  I must be very bad at explaining this LOL! I wasn't using "real" RAM to denote physical RAM; of course, it has what it has in that regard. (Has anyone ever soldered in more on a Droid 4? 🙂I was using it to denote RAM available for use without any trickery involved. A word about swapping might help here. Swapping is an old concept where the kernel takes a page of RAM, dumps it somewhere else called a swapspace, and then frees the RAM page. If/when that data is needed later, it will copy it back, often after swapping off another page to make room. It is cumbersome to the kernel and slows things considerably in some cases, and is really only useful in situations where the physical RAM is not really enough to get the job done; it is a workaround for a low RAM configuration. ZRAM hijacks that kernel function. ZRAM creates a swapspace which it shows to the kernel as available so it will feed it RAM pages to stash for later. It compresses this data before storing it in an allocated area of physical RAM. This trickery allows the cramming of more stuff into the physical RAM. However, because ZRAM is still stored in RAM, as the amount of stuff stored in ZRAM increases, the amount of RAM accessible outside of ZRAM's trickery necessarily decreases; by a lesser amount than the ZRAM grew, if the data in ZRAM is compressible, but this means that over time, less and less native, untricked RAM is available. The degree to which ZRAM is advantageous is also directly proportional to the compressibility of the data it is storing. Filesystem swap on SD has none of these limitations. Because it is stored outside of RAM, data swapped there doesn't compete with the native RAM at all, leaving it all still freely available for use by whatever needs it, and it also doesn't matter if the data is compressible or not, since compression is not involved. You mentioned swapping to disk, but that is exactly what the kernel believes it IS doing when ZRAM is used. True, RAM is much faster than SD, but the compressing and decompressing of the data takes CPU cycles, which may or may not end up being faster than I/O in any given circumstance, depending on CPU speed, load and I/O performance. Also, in their default state, every Android ROM I've ever seen had no disk swap available at all (not counting the ZRAM virtual disk.) If they ran out of RAM, they ran out of RAM, and there was nothing to do for it but kill processes. Adding disk swap has to be done manually, first by creating the swapspace, and then by using a terminal command to activate it after every boot, or adding the command to the startup script. In my case I have a fast SD, a relatively slow CPU, and a tendency to load the CPU heavily as a result. For me, the performance of ZRAM and SD swapping on my device and in my use cases are very similar. Both would be considered very slow by normal people LOL. I choose SD over ZRAM because on my device it is much more stable, and occasionally it is actually a little faster, again because all of the RAM is accessible without trickery. Hopefully this explains the things that were puzzling you. 🙂 1 Quote Link to post Share on other sites
_DW_ 628 Posted January 16, 2020 Share Posted January 16, 2020 4 hours ago, silversolver said: I must be very bad at explaining this LOL! I wasn't using "real" RAM to denote physical RAM; of course,............ This has always been a balance between different speeds of things.  Another reason to swap is to get contiguous memory (some idiot allocated too much :D) 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.