Improve performance of JID and BareJID classes (#22)
Andrzej Wójcik (Tigase) opened 8 years ago
Due Date
2016-08-05

JID and BareJID classes are simple, however are used very ofter during processing. As I checked creation of JID and BareJID is not as fast as it should.

It looks that it is caused by code responsible for parsing string to JID (lookup for / and @ as well as splitting strings).

We need to find better way to parse JID.

It may also be a good idea to cache JID instance of stanza returned by to and from as now they are constructed every time.

Andrzej Wójcik (Tigase) commented 8 years ago

After checking performance of parsing JID and BareJID and comparing with alternative methods looks like we are using the fastest one I've found.

Due to that I added caching of JID and BareJID instances in Stanza instance to reduce number of instantiations of JID and BareJID during processing of incoming packets. This reduced processing time and improved performance of library.

+Note:+ From now on it is required to modify from and to of stanza instance always using stanza properties instead of direct manipulation of attributes of stanza element. Direct manipulation of attributes may lead to invalid values being returned by stanza instance! This information was added to library documentation of Stanza class.

Referenced from commit 1 year ago
issue 1 of 1
Type
Task
Priority
Normal
Assignee
RedmineID
4393
Issue Votes (0)
Watchers (0)
Reference
tigase/_libraries/Martin#22
Please wait...
Page is in error, reload to recover