Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Perthis vs ITD

Keith Kowalczykowski wrote:
>     I am little bit confused about the differences between perthis and ITD,
> and was hoping someone could enlighten me. I am currently using ITD to
> inject some fields/methods into our classes. From what I gather, perthis can
> provide similar behavior as ITD (at least for fields). Is this a correct
> assumption? If so, what are the benefits of using ITD over perthis? In
> summary, I'm trying to figure out if there is any advantages (performance,
> etc) to using perthis vs ITD. Thanks for your help.

You assume correctly - they accomplish similar things, but in different
ways. Off the top of my head some main differences are

- perthis has naturally higher creation/access overhead/GC pressure than IDT

- with concurrent code perthis will likely have some form of contention
for the aspect reference table, unlike IDT

- perthis does not modify the structural layout of the class, whereas ITD
can break serialization (but then again that is broken either way ;)

- there may be some cases where methods/fields cannot be added to a class
via IDT because they already exist..not sure if that is an actual problem
since you can just rename them in the advice.

I'd always go for IDT first because it seems cleaner, and fall back to
perthis if it breaks the advised class for whatever reasons. Can't
remember when that was actually the case..

Holger



Back to the top