Skip to content

[Java] fast object copy implementation using JIT codegen #1680

@chaokunyang

Description

@chaokunyang

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions