This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- faster access to some math library functions | |
local abs = math.abs | |
local Round = math.Round | |
local sqrt = math.sqrt | |
local exp = math.exp | |
local log = math.log | |
local sin = math.sin | |
local cos = math.cos | |
local sinh = math.sinh | |
local cosh = math.cosh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void iterateAndApplyMethodBetweenTwoPoints(Vector2 pos1, Vector2 pos2, Supplier<FunctionInput> function) { | |
// If the two points are the same no need to iterate. Just run the provided function | |
if (pos1.epsilonEquals(pos2)) { | |
function.invoke(); | |
return; | |
} | |
int matrixX1 = pos1.x; | |
int matrixY1 = pos1.y; | |
int matrixX2 = pos2.x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- Inventory Abstraction Library | |
-- Inventory Peripheral API compatible library that caches the contents of chests, and allows for very fast transfers of items between AbstractInventory objects. | |
-- Transfers can occur from slot to slot, or by item name and nbt data. | |
-- This can also transfer to / from normal inventories, just pass in the peripheral name. | |
-- Use {optimal=false} to transfer to / from non-inventory peripherals. | |
-- Now you can wrap arbritrary slot ranges | |
-- To do so, rather than passing in the inventory name when constructing (or adding/removing inventories) | |
-- you simply pass in a table of the following format | |
-- {name: string, minSlot: integer?, maxSlot: integer?, slots: integer[]?} |