Use 64-bit integers for signals
Moderator: ickputzdirwech
Use 64-bit integers for signals
Right now, the circuit network uses 32-bit integers for signals. If you're counting items, this is more than plenty, but the limit of ~4 billion can be a bit limiting when measuring other values, e.g. energy.
Right now, I'd like to be able to set a circuit signal to measure energy in J, but because of the ~4G limit, this isn't very practical, and I instead have to measure in kJ. If there were 64-bit signals, this wouldn't be an issue, as the limit would be raised to ~18E.
I can't imagine this causing any noticeable performance cut, even on 32-bit systems. If people are relying on integer overflow I think it's reasonable to expect people to use an arithmetic combinator to chop off the extra bits. Honestly, I'd personally prefer that signals saturated (e.g. stay at the maximum) rather than overflowing, but it doesn't matter too much.
Right now, I'd like to be able to set a circuit signal to measure energy in J, but because of the ~4G limit, this isn't very practical, and I instead have to measure in kJ. If there were 64-bit signals, this wouldn't be an issue, as the limit would be raised to ~18E.
I can't imagine this causing any noticeable performance cut, even on 32-bit systems. If people are relying on integer overflow I think it's reasonable to expect people to use an arithmetic combinator to chop off the extra bits. Honestly, I'd personally prefer that signals saturated (e.g. stay at the maximum) rather than overflowing, but it doesn't matter too much.
Re: Use 64-bit integers for signals
If I can have displays that count every copper wire produced in my megabase which goes into the billions I am all for it! It's always been feeling like a waste to count stuff if the limit the game can count on a combinator is so limited...lightdark wrote: ↑Sun Oct 20, 2019 3:32 am can't imagine this causing any noticeable performance cut, even on 32-bit systems. If people are relying on integer overflow I think it's reasonable to expect people to use an arithmetic combinator to chop off the extra bits. Honestly, I'd personally prefer that signals saturated (e.g. stay at the maximum) rather than overflowing, but it doesn't matter too much.
- BlueTemplar
- Smart Inserter
- Posts: 3110
- Joined: Fri Jun 08, 2018 2:16 pm
- Contact:
Re: Use 64-bit integers for signals
Factorio has dropped support for 32-bit systems with 0.14/0.15 :
https://factorio.com/blog/post/fff-158
https://factorio.com/blog/post/fff-158
BobDiggity (mod-scenario-pack)
Re: Use 64-bit integers for signals
OP is clearly talking about switching from uint32 to uint64 integer variables in terms of signal value storage, not about memory adressing and hardware architecture issues. I mean, you definitely can store a quad in a 32bit app.BlueTemplar wrote: ↑Sun Oct 20, 2019 12:28 pm Factorio has dropped support for 32-bit systems with 0.14/0.15 :
https://factorio.com/blog/post/fff-158
Last edited by kbk on Sun Oct 20, 2019 1:22 pm, edited 1 time in total.
- BlueTemplar
- Smart Inserter
- Posts: 3110
- Joined: Fri Jun 08, 2018 2:16 pm
- Contact:
Re: Use 64-bit integers for signals
What else could he mean with "32-bit systems" ?
P.S.: My point is that performance worries on 32-bit systems aren't relevant.
P.S.: My point is that performance worries on 32-bit systems aren't relevant.
BobDiggity (mod-scenario-pack)
Re: Use 64-bit integers for signals
Yep, took me too long to edit previous post, sorry. OPs suggestions about 32bit applications just were met by a technically correct but quirky response I became too tempted to clarify, that's allBlueTemplar wrote: ↑Sun Oct 20, 2019 1:20 pm What else could he mean with "32-bit systems" ?
P.S.: My point is that performance worries on 32-bit systems aren't relevant.
-
- Filter Inserter
- Posts: 502
- Joined: Tue Jun 26, 2018 10:14 am
- Contact:
Re: Use 64-bit integers for signals
I want 64b arithmetic too. My numbers are not so big, but I use various mathematical formulas and sometimes there are large intermediate results inside.
Re: Use 64-bit integers for signals
Yup! Having to use double the space to store every signal could definitely cause performance issues.kbk wrote: ↑Sun Oct 20, 2019 1:19 pmOP is clearly talking about switching from uint32 to uint64 integer variables in terms of signal value storage, not about memory adressing and hardware architecture issues. I mean, you definitely can store a quad in a 32bit app.BlueTemplar wrote: ↑Sun Oct 20, 2019 12:28 pm Factorio has dropped support for 32-bit systems with 0.14/0.15 :
https://factorio.com/blog/post/fff-158
P.S.: I'm not a guy; note that the others used "OP" to refer to me instead of "he."BlueTemplar wrote: ↑Sun Oct 20, 2019 1:20 pm What else could he mean with "32-bit systems" ?
P.S.: My point is that performance worries on 32-bit systems aren't relevant.
Re: Use 64-bit integers for signals
According to this post from 2011: https://www.passmark.com/forum/performa ... -maths-pt8lightdark wrote: ↑Sun Nov 10, 2019 10:23 pmYup! Having to use double the space to store every signal could definitely cause performance issues.kbk wrote: ↑Sun Oct 20, 2019 1:19 pmOP is clearly talking about switching from uint32 to uint64 integer variables in terms of signal value storage, not about memory adressing and hardware architecture issues. I mean, you definitely can store a quad in a 32bit app.BlueTemplar wrote: ↑Sun Oct 20, 2019 12:28 pm Factorio has dropped support for 32-bit systems with 0.14/0.15 :
https://factorio.com/blog/post/fff-158
P.S.: I'm not a guy; note that the others used "OP" to refer to me instead of "he."BlueTemplar wrote: ↑Sun Oct 20, 2019 1:20 pm What else could he mean with "32-bit systems" ?
P.S.: My point is that performance worries on 32-bit systems aren't relevant.
There's no performance impact, except for division, but then again, it's from 2011, it's migth be better.
The larger memory footprint should be an issue though.
Re: Use 64-bit integers for signals
Unless I'm mistaken the LUA interpreter uses double for everything. That means 64bit signals would not be fully usable from mods. You would only get 56 bit precision iirc. I think that's a show stopper.
Also every setup that uses the integer overflow hack would break when you switch to 64bit signals. Although they could switch to the new constant to overflow at 64bit. A migration script could even change every constant close to 2G to their 64bit equivalent.
Also every setup that uses the integer overflow hack would break when you switch to 64bit signals. Although they could switch to the new constant to overflow at 64bit. A migration script could even change every constant close to 2G to their 64bit equivalent.
- BlueTemplar
- Smart Inserter
- Posts: 3110
- Joined: Fri Jun 08, 2018 2:16 pm
- Contact:
Re: Use 64-bit integers for signals
LUA interpreter doesn't have integer support ?!?
My bad.
BobDiggity (mod-scenario-pack)
Allow integer values up to the 64 bit boundaries in the circuit network
TL;DR
Allow integer values up to the 64 bit boundaries in the circuit networkWhat ?
As the 32 bit support was dropped (I read somewhere) allow integer values of up to the 64 bit boundaries in the circuit network.Why ?
This would allow for calculations which need big numbers.Re: Allow integer values up to the 64 bit boundaries in the circuit network
Where did you read that?
Changing circuit network from 32 signed to 64 signed would break all designs making use of integer overflow. Not world ending, but the argument of not wanting to break existing circuit designs has been used for years to defend mathematical correct fluid rounding.
Changing circuit network from 32 signed to 64 signed would break all designs making use of integer overflow. Not world ending, but the argument of not wanting to break existing circuit designs has been used for years to defend mathematical correct fluid rounding.
My Mods: mods.factorio.com
Re: Allow integer values up to the 64 bit boundaries in the circuit network
Just because Factorio is no longer compiled for 32bit systems doesn't mean it uses 64bit data types throughout.
Factorio still uses Lua 5.2, 64bit types where introduced in Lua 5.3.
http://www.lua.org/manual/5.2/manual.html#2.1
http://www.lua.org/manual/5.3/manual.html#2.1
Edit: It is possible Factorios Lua implementation already uses 64bit.
Factorio still uses Lua 5.2, 64bit types where introduced in Lua 5.3.
http://www.lua.org/manual/5.2/manual.html#2.1
http://www.lua.org/manual/5.3/manual.html#2.1
Edit: It is possible Factorios Lua implementation already uses 64bit.
My Mods: mods.factorio.com
- BlueTemplar
- Smart Inserter
- Posts: 3110
- Joined: Fri Jun 08, 2018 2:16 pm
- Contact:
Re: Allow integer values up to the 64 bit boundaries in the circuit network
duplicate : 77006
BobDiggity (mod-scenario-pack)
Re: Use 64-bit integers for signals
Merged, thanks to BlueTemplar
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...
-
- Filter Inserter
- Posts: 502
- Joined: Tue Jun 26, 2018 10:14 am
- Contact:
Re: Use 64-bit integers for signals
A second tier of circuit items could be added to not break existing 32b hacks. There also can be different networks for 32b and 64b signals if they really cannot be mixed. Floating point calculations could be also considered. Why not? It's not a rocket science.
Last edited by coppercoil on Mon Feb 03, 2020 12:18 pm, edited 1 time in total.
Re: Use 64-bit integers for signals
Or it could be 56 bit signals so they still fit in a double.
Re: Use 64-bit integers for signals
"There's no performance impact, except for division, but then again, it's from 2011, it's migth be better."
This is a microbenchmark. When you take cache into consideration it has an impact.
Though the whole system is complex and such a little change would likely not matter in the end.
"A second tier of circuit items could be added to not break existing 32b hacks."
The problem is that signals are stored the same regardless of the entity type. This would only increase implementation complexity.
"Or it could be 56 bit signals so they still fit in a double."
Lua DOES have integer types
This is a microbenchmark. When you take cache into consideration it has an impact.
Though the whole system is complex and such a little change would likely not matter in the end.
"A second tier of circuit items could be added to not break existing 32b hacks."
The problem is that signals are stored the same regardless of the entity type. This would only increase implementation complexity.
"Or it could be 56 bit signals so they still fit in a double."
Lua DOES have integer types