Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up parsing #14

Open
PMunch opened this issue May 2, 2018 · 9 comments
Open

Speed up parsing #14

PMunch opened this issue May 2, 2018 · 9 comments

Comments

@PMunch
Copy link
Owner

PMunch commented May 2, 2018

Combparser turns out to be fairly slow. This is probably caused by it's very recursive nature and lot's of string slicing (which creates a new copy of the string). As a means to fix this either combparser need to be sped up by improving how it handles strings internally, or a new parser needs to be written/implemented.

@zevv
Copy link

zevv commented Nov 8, 2019

Well, too bad: I implemented the parser in NPeg today, but the compiler does not agree when running at compile time:

Error: VM problem: too many registers required

@zevv
Copy link

zevv commented Nov 8, 2019

Ok, mistake: I was running an old Nim version, but this has recently been fixed on devel. Parser works at compile time.

@PMunch
Copy link
Owner Author

PMunch commented Nov 13, 2019

But only for devel? Have you tried the parser with any more complicated protobuf files?

@zevv
Copy link

zevv commented Nov 13, 2019 via email

@madasebrof
Copy link

I love the concept and usage of this library!

But I noticed this issue, so I thought I'd post here. I was trying to use this to decode a fairly large byte array (51x512), but the results are unusable.

It takes 2ms to read data off the socket into a string, then another 90ms (!) to parse.

Executing task server in .../protobuf_tester.nimble
Server: started. Listening to new connections on port 8888...
Server: client connected
2.60ms - got raw message = 1048727 bytes - 93.29ms - parsed protobuf 
2.08ms - got raw message = 1048727 bytes - 91.03ms - parsed protobuf 
1.95ms - got raw message = 1048727 bytes - 92.02ms - parsed protobuf 
1.72ms - got raw message = 1048727 bytes - 92.05ms - parsed protobuf 
1.95ms - got raw message = 1048727 bytes - 91.40ms - parsed protobuf 

@PMunch
Copy link
Owner Author

PMunch commented Oct 29, 2021

Do you have a test case?

This should really be it's own issue though. The original issue is about the speed of parsing the protoc files and not about the runtime speed.

@PMunch
Copy link
Owner Author

PMunch commented Oct 29, 2021

And @zevv, do you still have that NPEG parser lying around? Probably works with the latest Nim versions so this could finally be implemented.

@zevv
Copy link

zevv commented Oct 29, 2021 via email

@PMunch
Copy link
Owner Author

PMunch commented Oct 29, 2021

And nothing useful in that file? Bummer..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants