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

AssocTable ctor is expensive #54

Open
tokreutz opened this issue May 12, 2016 · 0 comments
Open

AssocTable ctor is expensive #54

tokreutz opened this issue May 12, 2016 · 0 comments

Comments

@tokreutz
Copy link

Description

When using fsyacc for parsing of smaller test strings, the ctor of the AssocTable is very expensive (relative to the actual parsing). This is due to the initial size of the dictionary cache (2000).

This seems to be a semi-known issue as a comment in the code states:
// Note: using a .NET Dictionary for this int -> int table looks like it could be sub-optimal.
// Some other better sparse lookup table may be better.

Repro steps

Profiling a parse of any small input shows that "AssocTable..ctor" includes a significant portion of samples, and that "Dictionary`2[System.Int32,System.Int32]..ctor" is the culprit. Compiling with a smaller initial cache size (e.g. 20) increases the performance for these inputs.

Expected behavior

I expect it to be either just cheaper, or configurable in some way so that this will yield better performance for smaller parsing inputs.

Actual behavior

Not able to configure this in any way right now.

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

No branches or pull requests

2 participants