In current implementation of Element class there is a lot of blocks synchronized on children collection.
In Tigase XMPP Server as I remember there was assumption that we should not modify received Packet or Element instance and we need to create copy of received instance to make any changes.
If this is true then we could remove synchronization on children collection in Element class as it is not needed and may introduce penalty during execution as each synchronized blocks requires some time to acquire locks and release them.
Andrzej Wójcik (Tigase) commented 10 years ago
I marked this as releated to #2866 as way to implement #2866 depends on this task.
Artur Hefczyc commented 10 years ago
I agree
Andrzej Wójcik (Tigase) commented 10 years ago
I removed synchronized block.
I also found a way to optimize toString() methods, which I did to improve performance of Element serialization.
In current implementation of Element class there is a lot of blocks synchronized on
children
collection.In Tigase XMPP Server as I remember there was assumption that we should not modify received Packet or Element instance and we need to create copy of received instance to make any changes.
If this is true then we could remove synchronization on
children
collection in Element class as it is not needed and may introduce penalty during execution as eachsynchronized
blocks requires some time to acquire locks and release them.