fury
fury copied to clipboard
[Java] fast object copy implementation using JIT codegen
Is your feature request related to a problem? Please describe.
In #1679 , the copy is implemented using loop and branch. We can optimize it by generate code to copy object attributes recusively.
Describe the solution you'd like
- For JIT serializer, don't generate copy code in previous serializer builder. copy is not needed by all scenarios, generate code for copy will make the jit slower and use more metaspace.
- Instead, we should generate a class which implement the copy interface and forward the copy to that class.
For example, we can add a copy forward implemetation in io.fury.builder.Generated.GeneratedSerializer:
public Object copy(Object o) {
Copy copier = this.copier;
if (copier == null) {
this.copier = copier = classResolver.getJITCopier(o.getClass());
}
return copier.copy(o);
}
Additional context
#1679 #1014