Skip to content

A more efficient version of another packet system thing i made, but this uses raw data in the packets, rather than formatted strings. Also containing ACK packets

License

Notifications You must be signed in to change notification settings

AngryCarrot789/REghZyIOWrapperV2

Repository files navigation

REghZyIOWrapperV2

A more efficient of another thing i made, that uses raw data in the packets, rather than formatted strings. Also containing ACK packets

Demo :)

This repo also contains 2 classes that i made: DataInputStream, and DataOutputStream :)

These are basically the same as java's DataInputStream and DataOutputStream, but i've optimised these and used some unsafe code to marginally increase speed (or decreased... hopefully not)

These allow you to read and write primitive data types (e.g WriteByte(), WriteLong(), etc)

To solve the problem with writing strings, i created a PacketUtils class, which contains a "WriteStringWL()" method (write string with label), which writes the length of the string (as 2 bytes), and then writes the chars. Similar thing for reading; read the 2 byte length, then read that many chars

ACK Packets

The idempotency key store works using nodes (it's basically a sort of node-based number range collection). And it also doesn't allow the key 0; must be 1 or above. It does mean that adding random numbers will be slower than just using a list (and it will use more numbers), but if the order of numbers is somewhat linear, it should heavily reduce the memory usage (especially if there's 100,000s of entries)

if you add 1 to 50000, and skip a number every 100 or so times, there should be around 500 nodes (1-99, 101-199, etc). Searching 500 nodes is probably faster than searching a list of 50,000 elements. The class could also be optimised to store an inner range, specifying the "missing" range between 2 nodes, e.g rather than have 2 nodes; 1-20, 23-40, you just have 1-40, and that node contains a "missing range" from 21-22

About

A more efficient version of another packet system thing i made, but this uses raw data in the packets, rather than formatted strings. Also containing ACK packets

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published