byte-buddy icon indicating copy to clipboard operation
byte-buddy copied to clipboard

Can byte-buddy modify bytecode in parallel?

Open 601724080 opened this issue 1 year ago • 4 comments

There are too many classes that need to be modified, and the modification time is now about 20 minutes, Can byte-buddy modify bytecode in parallel?

601724080 avatar Jul 25 '24 08:07 601724080

Byte Buddy's public API is fully immutable and therewith thread-safe. How are you using the API?

raphw avatar Jul 26 '24 12:07 raphw

Sorry, My PC don‘t work until today。 It's roughly written like this:

agentBuilder.with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION)
                .with(new RedefinitionListener())
                .type(pluginFinder.buildMatch())
                .transform(new BaseTransformer(pluginFinder))
                .with(new TransformListener())
                .installOn(instrumentation);

And the BaseTransformer implements AgentBuilder.Transformer。

601724080 avatar Aug 02 '24 01:08 601724080

Any class will be transformed in the thread loading the class. If parallel class loading is supported, Byte Buddy will also modify classes in multiple threads.

raphw avatar Aug 04 '24 20:08 raphw

I‘ll have a try, thank you.

601724080 avatar Aug 12 '24 01:08 601724080