WeBWorK Problems

Slow load times with PGgraphmacros.pl

Re: Slow load times with PGgraphmacros.pl

by Davide Cervone -
Number of replies: 0
I've looked into the issue, and the problem seems to be cause by the fact that the new MathObject-based graphing routine uses the Formula's eval() method rather than a compiled perl expression. The eval() method interprets the formula "by hand" from the parse tree, and so will always be slower than a native Perl expression.

Fortunately, MathObject Formula objects can produce compiled versions of their formulas, and switching to that makes the graphing macros work again at their original speeds.

The only problem was the graph macros expect the function to return an undefined value when an error occurs, while the MathObjects perl function throws an error instead. I had to work a little bit to trap the errors, but that is taken care of now, so you should be able to get the speeds you are used to again.

Update your pg/macros/PGgraphmacros.pl and pg/lib/Value/WeBWorK.pm files, then restart the server, and you should be in business. Please let us know if this takes care of the problem for you.

Davide