Redstone Lag: Busting all the myths!
Myth 1. Redstone clocks... sooo laggy!
http://www.minecraftforum.net/forums/mi ... dstone-lag
Redstone clocks are usually considered the most laggy object that a player can put in his/her game. This however, is not because of the usually assumed fact that it is the redstone updating that it causing it. It is actually the lighting updates caused by the redstone.
First off let's do some experimenting to show just how bad block light level updates can be (I will now call them BLLUs for the sake of not making this a wall of text) Start by making a blank superflat creative world. Now go up about 50 or so blocks and make a 50x50 platform one block thick of any block that isn't transparent, such as cobblestone.
Now you should have a pretty big dark patch underneath the platform. Now go somewhere near the middle and punch a hole. Did you experience the lag? Now what could be causing that? Well it's BLLUs. See the way the game works with BLLUs is that when you punched that hole in the platform it is actually checking EVERY BLOCK IN THAT CHUNK BELOW THAT AREA. This includes air blocks, as it checks them for transparency. So you can imagine how many blocks the game has to check just for the sake of one block being removed.
Your probably saying "Rush this is all well and good, but what does this have to do with my redstone?" Well it has a lot to do with your redstone actually, because redstone actually has two components that give off light, the redstone torch, and the repeater. The redstone dust does NOT give off light. Suddenly things are starting to be clearer. Not only are you getting minimal redstone lag but your also getting the worse BLLU lag. Think about it whenever doing some complex wiring what does everyone usually do? They usually run wool or some other sort of block up and around wherever they are working to move the redstone where they need it. Chances are you have some repeaters or maybe some redstone torches that invert every so often no big deal right? Wrong. As these repeaters and torches turn on and off they are producing light which leads to lag, even worse still is if they are on just a single line of blocks because that extra light is leaking over the edge and causing even more BLUs.
So, how do you fix this?
Let me introduce you to your new best friend...Glowstone. Yes that's right glowstone. How will this help me you ask? Well let me tell you. If you were to encase your redstone torches and your repeaters in glowstone (generally 3 blocks in front, behind and on top of your redstone torches and repeaters) that would saturate that area with block light meaning that when the repeaters or torches change state there would be no BLU, thereby eliminating the lag caused by them. It's really that simple, this method can be used on big circuits or small and it will make a difference.
Another way to stop light updates is to make your redstone compact! By removing air spaces, you are removing potential lighting updates. By lighting your redstone clocks correctly, even with 1000 running at once (I tested it) it doesn't have a notable effect on your fps and server lag.
Also, you may say that of course it causes server lag, think of all those calculations running at once! If you say this, you are correct. It does cause some server lag, but if the server was to run 4000000000 calculations in one second and the redstone clock caused 5, then you would need 800 million redstone clocks to cause your fps to go to 0! (these numbers are not accurate but to convey my point).
Let me repeat, redstone clocks do NOT cause server lag if correctly lighted!
For more information on this experiment, look at the link at the top of this 'redstone myth'.
If you block off the places for the redstone to light all together, you remove even more lag as lighting it still causes a few but less updates!
Myth 2. Hoppers, even when off cause lag!
http://minecraft.gamepedia.com/User:Cru ... Setup=true
Hoppers are usually considered on par with redstone clocks for lag. Even when behind a wall, they can massively reduce fps and increase cpu usage. Unfortunately, people jump to conclusions and think that its the rate that hoppers transport items that increases lag, or that the game is miscalculating the visuals of the hoppers. Both of these misconceptions are incorrect.
A test was conducted to see the lag effects of item systems stationary and in motion.
There are several mechanisms that cause lag on SMP, however the worst by far are activated hoppers, even when they are not transporting items. Suprisingly, hoppers on a fast clock were lag-free. In single-player mode, lag is more affected by entities moving into and out of the border range of render. This is a test of lag in multi-player mode across the Internet. Results will not be duplicable in a single-player game.
A test world was created and hosted by Cruddly using MCEdit for its copy and paste abilities, containing completely separate regions (~500 block separations) of various lag-causing entities and a remote player (Xenoflot) on a reasonable Internet connection (63ms ping to server), and reasonable but average computer. The server (ver 1.7.9) was running off a ramdisk on a powerful 8-cpu modern computer with just the host and the single remote player present, to eliminate other possible causes of lag. The results so far are reported below.
4096 chained, activated hoppers, with NO items moving them: chests were unopenable even after several minutes of waiting, blocks unbreakable and unplaceable.
4096 chained, de-activated hoppers: no lag
4096 stationary minecarts with chests: no lag
4096 shuttling minecarts with chests: player was kicked, server crashed out of memory. In other tests with more memory, even the local player experienced visual lag as well as block placement etc issues.
4096 stationary activated minecarts with hoppers: worse lag effects than plain hoppers.
4096 stationary de-activated minecarts with hoppers: no lag
4096 droppers with no active clock circuit: no lag
4096 droppers moving items on a 2-tick clock circuit (via torch towers): no lag!!! Unbelievable. Slower clock speed tests abandoned. The droppers were checked to ensure the items were moving along. Remote player could clearly see the flashing patterns of the torches "like a christmas tree".
4096 chests (configured as 2048 large chests): no lag - control set.
4096 blocks of vertically flowing water: no lag
4096 blocks of horizontally flowing water: no lag
4096 fire blocks (flaming Netherrack): no lag. An interesting result, and maybe only due to the test setup having nothing but airspace near the fires, as fire-based lag has been experienced before.
4096 stained glass blocks, single depth, single color: no lag
4096 stained glass blocks, two colors, adjacent vertical planes: no lag
4096 stained glass blocks, two colors, air block plane between the vertical planes: no lag
Although it is highly unlikely a single set of loaded chunks would contain 4096 of the tested items, never-the-less small numbers still create noticeable lag - to a small degree dependant upon: the hardware of both server and client, and Internet speed between them.
With the proliferation of hoppers in recent devices, it is advisable for designers to find ways to deactivate hoppers that are not currently in use - either automatically through circuit design, or manually via levers and so on. Where space allows for the accompanying power transmission, droppers are a far more reasonable alternative, and redstone clocks far less laggy than their hopper counterparts.
It doesn't take long before a dozen different devices, all containing at least several hoppers, add up to a noticeable lag burden upon remote clients.
Myth 3. (Extras for myth 2) Hoppers cause lag when activated no matter what (Also assumed in myth 2's study).
This is another commonly assumed fact. Even in the last myth, the people conducting the experiment assumed this and concluded incorrect results.
Rumor has it that placing a block with an inventory such as a furnace on top of a hopper reduces lag. Iet's find out if it's true and how much difference it actually makes if it does...
This video shows the effects on a server that placing a inventory over a hopper has. It proves that most of hopper's but not all lag can be removed by placing an inventory over it. This is because the hopper no longer wished to pick dropped items up when this is happening. Note: solid blocks above hoppers will not decrease lag!
It decreases around 85% off hopper lag (the lag not removed is due to the visuals).
Myth 4: Redstone causes Chunk loading (comment bellow was talking about it).
http://www.minecraftforum.net/forums/mi ... ith-design
Apparently many people believe that redstone when active loads the chunk it is in. This is not the case. I have personally done a lot of research into this topic as I have used chunk loaders frequently (not on minesquish). Redstone can be active within an unloaded chunk. For example, flowing water will not update within the chunk where redstone is active, wheat and other plants will also not grow.
I don't think this contraption is working. Redstone and pistons can operate even in unloaded chunks, but they are loading just the blocks which they are updating. The only way I know how to load any chunk is by throwing items into the portal from Nether side. Unfortunately there is no way of loading Nether chunk if the player is in the Overworld so I don't think it can be exploitable.
If anybody knows if there is something that works, please share it... Could be really helpful.
This quote is similar to many other posts on many other forums about chunk loading. Yes, you can load chunks using nether portals, but not using plain redstone clocks or circuits or even pistons even if they are going over chunk borders. However there is another way to load chunks in minecraft. This way uses hoppers and is shown in the youtube video link. It explains how by stringing hoppers over chunk borders, you can partially load chunks (this is the same kind of chunk loading that nether portals achieve). This is also why nether portals cause a lot of lag. This does keep redstone working 100% within these partially loaded chunks (redstone can glitch out and lock which is a problem on large projects out of chunk range), but does not keep entities like enderpearls loaded and doesn't make wheat grow. However, using this method, if you load a 5x5 area of chunks, the center chunk is fully loaded and will keep entities working, and will grow plants.
This 5x5 chunk loading is explained in Ethos lets play episode 406 at 7:00 in when he uses it to main a teleporter.
https://www.youtube.com/watch?v=eRibPph ... FWJW1vYsMA
So, you don't have to worry about redstone loading chunks, but the lighting updates once again can cause lag(although I havn't tested if they cause lag in unloaded chunks).
Steps to reduce redstone lag:
1. light up redstone circuits.
2. fill or remove air gaps in redstone circuits.
3. fill in any surrounding air around the redstone to stop the light from escaping.
4. place inventories like furnaces above hoppers which are not picking up items(hoppers themselves also work).
5. turn off hoppers when not using them by either by powering them by a redstone signal or manually with a lever.
If you do all 5 of these things in all your builds, the server will speed up substantially.