[QFJ-425] Performance and type safety improvment in MessageCracker.crack Created: 27/Mar/09  Updated: 10/Oct/12  Resolved: 10/Oct/12

Status: Closed
Project: QuickFIX/J
Component/s: Message Generation
Affects Version/s: 1.4.0
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: Bill Nokes Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Environment:

All



 Description   

Hi,

Low priority, but using instanceof instead of msgType.equals(XXX) pattern in MesageCracker.crack
will give a marginal performance boost and improve type safety.

Instead of:

if (msgTypeValue.equals(Heartbeat.MSGTYPE))

{ onMessage((Heartbeat) message, sessionID); } else if (msgTypeValue.equals(Logon.MSGTYPE)) {

Use:

if (message instanceof Heartbeat) { onMessage((Heartbeat) message, sessionID); }

else if (message instanceof Logon) {

Also drops requirement to dig into header to get message type.

Hope this helps,
Bill



 Comments   
Comment by Christoph John [ 10/Oct/12 ]

The MessageCracker implementation has been completely changed with QF/J 1.5.1 so this ticket has become obsolete.

Generated at Sat May 18 20:05:25 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.