Hi Thrift devs,

I maintain a Thrift implementation that is specialized for Android 
(https://github.com/Microsoft/thrifty), and am curious if there is any interest 
in accepting something like this in Apache Thrift.  I’ll try to be brief and 
summarize.

Briefly, on Android we have a system limitation such that application code is 
limited in the number of methods that can be referenced – 65,535 to be precise. 
 The generated Java code from the Apache compiler is very heavy in this respect 
– the app that I work on, for example, has about 300 thrift structs which 
occupied 35,000 of the methods at our disposal.  We ended up hitting the limit, 
which meant that we could no longer add code to our app without either removing 
other code or using slow/bug-prone workarounds.

With that motivation, we implemented our own Thrift compiler and runtime.  The 
key notions are:
- No getters and setters - struct fields are Java fields
- No isSet/setIsSet - unset fields are represented by null
- No schemes or factories

This plays a little loosely with the accepted meanings of 
required/optional/default requiredness, but at least in client usage it is 
sound.  This approach took us from 35,000 methods to 6,400, a substantial 
improvement.

With all that being said, I think there is room for some of these ideas as a 
new runtime/codegen pair.  Facebook’s fbthrift fork has something similar 
which, although it doesn’t go as far as what we’ve done, demonstrates the need 
for such a feature.  I’m interested in your thoughts!

Thanks,
Ben

Reply via email to