The Factorio Benchmark Website

test-000034 : When using cars as a handoff, is it better to leave the fuel and ammo slots empty, or fill them?

Factorio Version 0.17.17

The TLDR

It appears to be very slightly better to leave both slots empty, rather than fill or partially fill them. However, these results could also be down to random chance or run to run variance, considering the similarity of the results.

The Question

When using cars as a handoff, you by default get two additional inventories. These are the fuel inventory and the ammo inventory. If using a car to handoff a material that doesn't go to one of these slots, we end up with potential additional checks to see if the material could go into those slots. If the slot is occupied, that check could have differing perfomance to the one performed to see if it is a fuel/ammo type item.

The Test

1 such passthrough unit.

For this test, we will create a very simple and synthetic setup. We will have a car fed by two stack inserters and drained by two stack inserters. Infinity chests will provide/void the items to those inserters. The cars will be filtered to every slot containing raw-fish, except the first slot containing and filtered to the copper cable being passed through.

These passthrough units will be copied to 5312 total such of these units.

Each car will be set such that fuel can be empty, can have 1 rocket fuel, or can have a stack of rocket fuel. The same applies to the ammo slot, where a firearm-magazine is used. Each of the possible combinations of these will also be tested. (Like fuel full, ammo has 1 magazine).

Each of these car passthrough units will be built such that no passthrough unit is on a chunk border.

Each design will be scaled identically, and a map saved of each permutation. All maps will be benchmarked using the --benchmark command for a duration of 10000 ticks. Each map will be benchmarked 3 times. All maps are re-saved in vanilla prior to benchmarking.

A single electric network powered by a single electric energy interface provides power to all power consumers in the map.

The Data

Data presented is the relative speed of each case compared to the no fuel no ammo case. The values of the average ms per tick are used, thus the lower the better.

Empty Ammo Partial Ammo Full Ammo
Empty Fuel 100.00% 100.62% 100.40%
Partial Fuel 100.88% 100.40% 100.31%
Full Fuel 100.43% 100.44% 100.36%

Here it can be seen that the case where no fuel or ammo present was the fastest.

The difference is very minor, with the delta being less than 1%. However, it is measurably worse to have partial or full stacks in those slots. There does not appear to be a significant difference between having a partial or full stack.

Speculatively, occupying the slots with data makes it more likely to fill the cache, like putting a rock in your pack. Alternatively, it could also be that the check is cheaper for the item's type, rather than checking if the thing in the slot matches the thing being inserted. However for this case, the difference is so minor that putting fuel in to get rid of the annoying blinking icon is probably worthwhile. Remember that this is the ultimate synthetic case, and even here we cant get a 1% delta.

Closing

Having fuel and ammo slots occupied has a apparent performance impact. You can't notice the difference except in the most synthetic of cases. Indeed, run to run variance could explain the delta seen here.