{"id":16375001,"url":"https://github.com/moderocky/pluto","last_synced_at":"2025-08-16T16:36:39.500Z","repository":{"id":103957329,"uuid":"524020957","full_name":"Moderocky/Pluto","owner":"Moderocky","description":"A low-memory serialiser system that prioritises speed.","archived":false,"fork":false,"pushed_at":"2022-08-13T09:12:45.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-01T04:15:09.377Z","etag":null,"topics":["bytecode","java","serialization","serialization-format"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Moderocky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-12T09:01:07.000Z","updated_at":"2023-05-29T07:36:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"7f305819-0b2d-45cc-98b5-3ef3be991255","html_url":"https://github.com/Moderocky/Pluto","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moderocky%2FPluto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moderocky%2FPluto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moderocky%2FPluto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moderocky%2FPluto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Moderocky","download_url":"https://codeload.github.com/Moderocky/Pluto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239954698,"owners_count":19724286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bytecode","java","serialization","serialization-format"],"created_at":"2024-10-11T03:19:04.838Z","updated_at":"2025-02-21T04:25:47.528Z","avatar_url":"https://github.com/Moderocky.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Pluto\n=====\n\n### Opus #21\n\nA low-memory serialiser system that prioritises speed.\n\n## Introduction\n\nPluto aims to provide object serialisation (marshalling and unmarshalling data from a format that can be written to the disk)\nthat is both memory-efficient (e.g. not building massive strings) and as fast as possible.\n\nIn order to make this work, Pluto must compromise.\nFirstly, the design is restricted to systems where the potential types of objects are known.\nSecondly, the design favours a more loosely-defined object (without final fields.)\nThese are not significant restrictions.\n\nWith these restrictions in mind, Pluto is able to create what is potentially the fastest serialiser possible (aside from dumping an object's heap memory representation.)\n\nWhen the serialisers are set up (ideally at the start of a program's run, or even during compilation)\nPluto will compile a new serialiser class for each required object type.\n\nA simple class like\n```java\nclass Person {\n    String name;\n    int age;\n}\n```\nwill have an equally-simple serialiser written.\n```java \nvoid run(Person person, DataOutputStream stream) {\n    stream.writeUTF(person.name);\n    stream.writeInt(person.age);\n}\n\nvoid run(Person person, DataInputStream stream) {\n    person.name = stream.readUTF();\n    person.age = stream.readInt();\n}\n```\n\nThis is potentially the fastest serialiser possible.\nAll field access is direct, with minimal overhead. No reflection is involved.\n\nThe serialiser can be configured to read or ignore non-public fields.\n\nIdeally, this serialiser should be written in advance. \\\nMarshalling and unmarshalling the data is fast and trivial,\nbut compiling the bytecode and inserting the new class takes longer.\n\nThe class is inserted as a nest-mate of the target so that it can see non-public fields.\n\nSerialisers support non-trivial object types under certain conditions:\n1. Regular serialisers cannot create new objects, so the field on the deserialiser target must be set already.\n2. The object must be accessible for reading and writing.\n\n## Unsafe Serialisers\n\nFor situations where more delicate serialisation is required (such as altering final fields that should have been assigned in the constructor)\nPluto provides unsafe serialisers.\n\nAn unsafe serialiser has equivalent speed to the regular serialiser, but is naturally more risky to use.\nThese serialisers copy the data to and from the stream directly into the VM's heap memory.\n\nA simple class like\n```java\nclass Person {\n    String name;\n    int age;\n}\n```\nwill have a serialiser written like so.\n```java \nvoid run(Person person, DataOutputStream stream) {\n    stream.writeUTF(unsafe.getObject(person, name));\n    stream.writeInt(unsafe.getInt(person, age));\n}\n\nvoid run(Person person, DataInputStream stream) {\n    unsafe.putObject(person, name, stream.readUTF());\n    unsafe.putInt(person, age, stream.readInt());\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoderocky%2Fpluto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoderocky%2Fpluto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoderocky%2Fpluto/lists"}