Method RegEx():optimize() Foundation

Optimizes the pattern for faster execution.

Syntax
:optimize( [<lJIT>] ) --> lSuccess
Parameters
<lJIT>
Set to .T. (true) to enable just-in-time (JIT) compilation. Set to .F. (false) to run the ordinary optimization pass. Defaults to .F.
When JIT is enabled, the engine generates native machine code instead of executing the pattern through its bytecode interpreter.
Return

.T. (true) if the optimization was successful, .F. otherwise.

Description

Performs an additional optimization step by analyzing the compiled pattern to gather information that can speed up matching. The pattern is compiled first if it has not been compiled yet.

In addition to increasing execution speed by applying hints gathered during the analysis, :optimize() can optionally compile the pattern into machine code if just-in-time compilation is enabled. This speeds up pattern matching even further.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.