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
Copy file name to clipboardExpand all lines: README.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,26 +1,28 @@
1
1
## What is PackMe
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 file.
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
+
4
+
## It is Fast
5
+
Spoiler alert! ~500k pack/unpack cycles per second for data of average size and complexity. Of course it depends on system configuration :)
3
6
4
-
## It is Fast
5
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.
6
8
7
9
## It is Simple
8
-
You do not need to learn any additional data format or special manifest syntax (like in case of using FlatBuffers or Proto Buffers), just use JSON! Everyone knows JSON, right? Objects, types and messages declarations are very simple and intuitive.
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.
9
11
10
12
## Usage
11
-
The best way of using it for client-server applications is by using ConnectMe package which provides all necessary stuff like adding listeners, calling asynchronous queries etc. But you can use it separately as well.
13
+
The best way of using it for client-server applications is by using ConnectMe package which provides all necessary stuff like adding message listeners, calling asynchronous queries etc. But you can use it separately as well.
12
14
13
15
Here's a simple manifest.json file (located in packme directory) for some hypothetical client-server application:
14
16
```json
15
17
{
16
18
"get_user": [
17
19
{
18
-
"id": "string",
20
+
"id": "string"
19
21
},
20
22
{
21
23
"first_name": "string",
22
24
"last_name": "string",
23
-
"age": "uint16"
25
+
"age": "uint8"
24
26
}
25
27
]
26
28
}
@@ -45,7 +47,7 @@ socket.send(packMe.pack(request)); // Some socket implementation
45
47
socket.listen((Uint8List data) {
46
48
final PackMeMessage? message = packMe.unpack(data);
47
49
if (message is GetUserResponse) {
48
-
print('He is awesome: ${message.firstName} ${message.firstName}, ${message.age} y.o.');
50
+
print('He is awesome: ${message.firstName} ${message.lastName}, ${message.age} y.o.');
0 commit comments