The problem right now is when an inserter wants to insert or remove an item, it has to check each slot until it finds a valid one, right? What if the chest inventory was split into three arrays- full slots, empty slots, and partially filled slots?
It works like this:
When an item needs to be inserted, it can check the list of partially filled slots first, which will be much smaller than the other two lists. If it can't fit the item type in, then it goes to the first slot in the empty slot list.
When an item needs to be taken out, it can check the list of partially filled slots first, then the list of filled slots. This can be expensive since it needs to iterate on the list of filled slots and that can potentially be large, but after it does so the item removed causes that slot to be a partial slot, which means the next removal is much faster.
Doing it this way means in most cases, the inserter only has to look at a list of 10 or less slots.
There is a side effect that if there are empty slots near the top of the container they won't be filled until partially filled slots are filled up. I don't think that will break any automation though.
Inserter/chest Optimization idea
Moderator: ickputzdirwech
-
- Smart Inserter
- Posts: 2768
- Joined: Tue Apr 25, 2017 2:01 pm
- Contact:
Re: Inserter/chest Optimization idea
There have already been multiple threads on this, some of which have dev answers.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics
Re: Inserter/chest Optimization idea
Yes, I did some searches and didn't see any ideas similar to mine.
Re: Inserter/chest Optimization idea
McFrugal, you forget the general use case of chests which your suggestion will make slower.
Optimizing suggestions need to think much, much deeper than the part you want to optimize, because the problem is highly complex: with your changes you change not only the problem, but also every other aspect of chests etc. and you need to think them all through, because you don’t have the code to just test it out like the devs can.
And it’s not so that this suggestion is not good. Everything fine with it, it just needs much more thinking and discussion around it; maybe we find a solution, maybe not.
Optimizing suggestions need to think much, much deeper than the part you want to optimize, because the problem is highly complex: with your changes you change not only the problem, but also every other aspect of chests etc. and you need to think them all through, because you don’t have the code to just test it out like the devs can.
And it’s not so that this suggestion is not good. Everything fine with it, it just needs much more thinking and discussion around it; maybe we find a solution, maybe not.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Re: Inserter/chest Optimization idea
Unless in modded land with 1000+ slot chests the 'scan the inventory' logic base game uses is not slow. It never shows up in profiling results for save files.
If you want to get ahold of me I'm almost always on Discord.
-
- Smart Inserter
- Posts: 2768
- Joined: Tue Apr 25, 2017 2:01 pm
- Contact:
Re: Inserter/chest Optimization idea
Well, the generic titles kind of lend themselves to open discussions, I feel, vs everyone posting their own different idea into different threads for the same topic.
But that wasn’t the main point/issue.
This was:
And they (the devs) have said this before in those threads I was referring to. That was my point.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics