Closed Saiv46 closed 4 years ago
We have a benchmark which currently sum the times for various value serialization. You can run it only for array and check whether it makes a difference.
It's clear that node-protodef is not optimal, previous experiences showed that it's 10-100x slower than manually written code.
If you're serious in your efforts to optimize protodef, the way to go is to produce a protocol json to JavaScript compiler. (The code is currently an interpreter). It would be a fun project but will also take some time.
On Sun, Sep 1, 2019, 13:03 Alexander Ivanov notifications@github.com wrote:
Using Array.push and accessing the object's result.value property is performance-cost by itself.
Maybe we should improve that?
[] Benchmark it [] Merge
You can view, comment on, or merge this pull request online at:
https://github.com/ProtoDef-io/node-protodef/pull/98 Commit Summary
- Update readArray at structures.js
- :oops:
File Changes
- M src/datatypes/structures.js https://github.com/ProtoDef-io/node-protodef/pull/98/files#diff-0 (17)
Patch Links:
- https://github.com/ProtoDef-io/node-protodef/pull/98.patch
- https://github.com/ProtoDef-io/node-protodef/pull/98.diff
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ProtoDef-io/node-protodef/pull/98?email_source=notifications&email_token=AAR437SJ4HWDXYUWV7ZIMG3QHOORBA5CNFSM4ISWN2MKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HIUKYUA, or mute the thread https://github.com/notifications/unsubscribe-auth/AAR437V4GLC5NGA2SFTNWSLQHOORBANCNFSM4ISWN2MA .
If you're serious in your efforts to optimize protodef, the way to go is to produce a protocol json to JavaScript compiler. (The code is currently an interpreter). It would be a fun project but will also take some time.
There's already performant code generators such as astring, I think I can somehow convert json protocol to AST in the future "compiler".
Sounds good
On Mon, Sep 2, 2019, 08:48 Alexander Ivanov notifications@github.com wrote:
If you're serious in your efforts to optimize protodef, the way to go is to produce a protocol json to JavaScript compiler. (The code is currently an interpreter). It would be a fun project but will also take some time.
There's already have performant code generators such as astring https://github.com/davidbonnet/astring#benchmark, I think I can somehow convert json protocol to AST in the future "compiler".
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ProtoDef-io/node-protodef/pull/98?email_source=notifications&email_token=AAR437T2ML2AJQLSIRQ2VRDQHSZMRA5CNFSM4ISWN2MKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5U4A2I#issuecomment-527024233, or mute the thread https://github.com/notifications/unsubscribe-auth/AAR437VF7LGMUXV4K3Q24KLQHSZMRANCNFSM4ISWN2MA .
switch
and context fields made compilation non-trivial.
Instead, I re-implementing this as classes to avoid polymorphism and then inline method functions with regexp.
Using Array.push and accessing the object's
result.value
property is performance-cost by itself.Maybe we should improve that?