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

Minimizing M2 calls in parser #79

Open
sommars opened this issue Nov 14, 2016 · 6 comments
Open

Minimizing M2 calls in parser #79

sommars opened this issue Nov 14, 2016 · 6 comments
Assignees

Comments

@sommars
Copy link
Collaborator

sommars commented Nov 14, 2016

Suppose we wanted to retrieve two rings R and S from M2, as could happen during m2_parse(). What if we called M2 once with the input of (R,S)? Would this improve speed?

@coneill-math
Copy link
Owner

This is unlikely to be easy to implement, as it requires the parser to peek ahead and grab several rings at once. After a recent update to m2(), subsequent calls are much faster.

@sommars
Copy link
Collaborator Author

sommars commented Nov 14, 2016

No, peaking ahead isn't necessary. Instead of getting them on the fly, wait til you finish parsing, then grab all of them at once.

@coneill-math
Copy link
Owner

But the value returned by m2() determines how they are parsed, and thus how subsequent parsing occurs. For instance, R^2 becomes a module if R is a ring, and an expression if R is a variable.

It is possible this can be done in a lazier fashion than it is right now, but I don't see a way to do so without significantly modifying the parser (both physically and philosophically). Perhaps we can reopen if it becomes a bottleneck in the future?

@sommars
Copy link
Collaborator Author

sommars commented Nov 14, 2016

Ohhhh, right. Yeah, that's true

@coneill-math
Copy link
Owner

coneill-math commented Nov 14, 2016

It is certainly worth looking into ways of minimizing the calls to m2() when parsing. Some ideas:

  1. Keep a list of known function/class names that will not need to be looked up.
  2. Check the format of the name (e.g. m2rintring0000000000001) and only look up those that don't fit.

Both of these can be subverted by a malitious user, but at some point we need to trust them. I will reopen so that we can (potentially) add this in a future version.

@coneill-math coneill-math changed the title Minimizing M2 calls Minimizing M2 calls in parser Nov 14, 2016
@coneill-math coneill-math reopened this Nov 14, 2016
@coneill-math coneill-math added this to the Future version milestone Nov 14, 2016
@coneill-math coneill-math self-assigned this May 7, 2017
@coneill-math
Copy link
Owner

Excess calls to m2() in the parser are more evident in the cloud version.

We should bump the priority on this.

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