You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PackMe is a lightweight library for packing your data into binary buffer (presumably in order to be sent over tcp connection) and unpacking it back to class objects described in a simple way via JSON manifest files.
2
+
PackMe is a lightweight library for packing your data into binary buffer (presumably in order to be sent over TCP connection) and unpacking it back to class objects described in a simple way via JSON manifest files.
3
3
4
4
## It is Fast
5
5
Spoiler alert! ~500k pack/unpack cycles per second for data of average size and complexity. Of course it depends on system configuration :)
6
6
7
-
Since PackMe generates .dart classes, there is no need for any resource demanding serialization/deserialization process. No intermediate steps involved, every class has it's own efficient methods to quickly put all data to Uint8List buffer and extract it. Comparing to popular solutions it's performance is similar to FlatBuffers and greatly outperforms Proto Buffers.
7
+
Since PackMe generates .mjs classes, there is no need for any resource demanding serialization/deserialization process. No intermediate steps involved, every class has it's own efficient methods to quickly put all data to Uint8List buffer and extract it. Comparing to popular solutions it's performance is similar to FlatBuffers and greatly outperforms Proto Buffers.
8
8
9
9
## It is Simple
10
10
No special file formats (like for FlatBuffers or Proto Buffers manifest files), just use JSON. Objects, types and messages declarations are very simple and intuitive.
@@ -27,52 +27,49 @@ Here's a simple manifest.json file (located in packme directory) for some hypoth
packMe.register(manifestMessageFactory); // Required by PackMe to create class instances while unpacking messages
63
64
64
-
server.listen((Uint8List data, SomeSocket socket) { // Some server implementation
65
-
final PackMeMessage? message = packMe.unpack(data);
66
-
if (message is GetUserRequest) {
67
-
GetUserResponse response = GetUserResponse(
68
-
firstName: 'Peter',
69
-
lastName: 'Hollens',
70
-
age: '39'
71
-
);
65
+
server.listen((/** Uint8Array */data, /** SomeSocket */socket) => { // Some server implementation
66
+
let message =packMe.unpack(data);
67
+
if (message instanceof GetUserRequest) {
68
+
let response =GetUserResponse('Peter', 'Hollens', 39);
72
69
socket.send(packMe.pack(response));
73
70
}
74
71
});
75
72
```
76
73
77
74
## Supported platforms
78
-
Now it's only for Dart. Will it be cross platform? Well it depends... If developers will find this package useful then it will be implemented for JavaScript and C++ I guess.
75
+
Now it's only for Dart and JavaScript. Will there be more platforms? Well it depends... If developers will find this package useful then it will be implemented for C++ I guess.
0 commit comments