FIXParser constructor takes approx 8 seconds
When creating a new FIXParser instance, the constructor takes approximately 8 seconds to complete.
console.log("start", new Date());
const FIXParser = require('fixparser');
console.log("create", new Date());
const fixParser = new FIXParser.default();
console.log("parse", new Date());
console.log(fixParser.parse('8=FIX.4.2|9=51|35=0|34=703|49=ABC|52=20100130-10:53:40.830|56=XYZ|10=249|'));
console.log("done", new Date());
produces the following output:
start 2018-06-27T08:52:48.148Z
create 2018-06-27T08:52:48.298Z
parse 2018-06-27T08:52:56.348Z
[ A {
fixVersion: undefined,
data:
[ [Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object] ],
string: '8=FIX.4.2\u00019=51\u000135=0\u000134=703\u000149=ABC\u000152=20100130-10:53:40.830\u000156=XYZ\u000110=249\u0001', description: 'Heartbeat',
messageType: '0',
messageContents: [ [Object], [Object], [Object] ],
bodyLengthValid: true,
checksumValid: true,
checksumValue: '249',
checksumExpected: '249',
bodyLengthValue: 51,
bodyLengthExpected: 51 } ]
done 2018-06-27T08:52:56.348Z
This seems like a long time. we are using the parser in web workers so this introduces a long delay when starting a worker up.
I'll try and do some more investigation and post additional info here should I discover the cause.
Yes, currently this is an issue.
The problem is that we parse all the spec files and pre-process all those into maps/sets. Some of this should be possible to do at buildtime and not runtime.
Thankful for suggestions!
I've proposed the message content map be pre-built in a PR #11.
It still needs a little work to tidy the process and add the prebuild step to the build, but just wanted to get some feedback from you on your thoughts on this approach, before I spend too much time on it?
The constructor seems to be sub second with this change.
Looks great! Commented in PR #11
Fixed in [email protected]. Thanks a lot!