Hi Mehmet, Great!!
BTW, as follow, Regards, 2007/7/17, Mehmet D. AKIN <[EMAIL PROTECTED]>:
On 7/17/07, Trustin Lee <[EMAIL PROTECTED]> wrote: > On 7/17/07, Rodrigo Madera <[EMAIL PROTECTED]> wrote: > > I had to develop an interface with save() and load() methods to serialize, > > and that bloats my objects and impacts maintainability. > > > > This Struct project really pays off for binary protocols. > > > > Trustin, > > What do you have in mind? Merge? Dependency? > > The author is a long-time user of MINA, and he'd like to donate the > code once the project becomes more mature because it's far from > perfection for now. I'd like to know what people including committers > think about the project. If the community's response is positive, we > could bring the project into our sandbox and merge it into trunk when > it's ready. > > Trustin > -- > what we call human nature is actually human habit > -- > http://gleamynode.net/ > -- > PGP Key ID: 0x0255ECA6 > Thanks for posting and comments Trustin and Mina users, I am the author of the javastruct. I have developed this library 3-4 years ago (with some help of a friend), and It really helped us to implement complex binary communication protocols with other devices and applications written in C, C++. We had 70-80 different message types and writing a different encoding-decoding code for each would be very difficult and error-prone, so we decided to automatize the process. It is a very simple idea and code is not complex, quite straightforward. It was for java 1.4 and had some other extras, but I decided to start JavaStruct project and rewrote-simplfy most of the code and made it use only Java 5 annotations. it still is nowhere near finished but basic stuff works. Currently it supports primitives, arrays, nested Structs and Struct arrays. (both Little and Big endian) I also added a special kind of field that gives the length of another array field in the struct, this pattern is used a lot in C world. Something like: struct Foo { int length; char* buffer;} The length of the buffer is defined in length field. If I start to use Mina Byte Buffers it will be great to add alignment support and get rid of Litle endian Data Streams. Performancewise for Classes with 2-3 fields or a few primitive arrays, JavaStruct is quite faster than Java serialization, for 8-10 primitive fields or simple arrays it is on par with java serialization. Please note that if you write your own decoding and encoding routines, they would be faster than Javastruct, because of reflection and sanity checks library uses. But it is still quite fast, 200-300 thousands simple messages per second is more than enough for most applications, generally bottleneck is somewhere else. I'll post more performance data later. Actually this is not the first java - struct library. Jean-Marie Dautelle's JScience library has an excellent struct Class,
BTW, It's not JScience, but Javolution project. but his
approach is different then mine. mines are simple Pojo's in JScience you have to use special classes, but his work is more complete than mine. Trustin, I wish to work on this project, but it is better to make it mature to be somewhat usable with Mina. So lets wait while I make some more progress on GoogleCode project site, and prepare usable jars, so that mina community can test it. Is it okay If I post occasional progress reports on mina mailing lists? Another question is the license, currently it is MPL, if it's inappropriate I an change it. regards Mehmet D. Akın
-- 向秦贤