Implement optimizer module
See original GitHub issueOptimizer module should transform a regular expression into an optimized version, replacing some sub-expressions with their idiomatic patterns. This might be good for different kinds of minifiers, as well as for regexp machines.
Example:
/[a-zA-Z_0-9][a-zA-Z_0-9]*\e{1,}/
Is transformed into:
/\w+e+/
We can implement the optimizer as a set of small transforms (this depends on issue #7, and issue #23).
Patterns to replace:
aa*
->a+
()
,(?:)
-<empty>
(remove empty groups)a{1,}
->a+
a{1}
->a
a{3,3}
->a{3}
[a-zA-Z_0-9]
->\w
[^a-zA-Z_0-9]
->\W
[\d\d]
->[\d]
(remove duplicates from char-class)[\d]
->\d
(remove char class for single char)[0-9]
->\d
[^0-9]
->\D
[ \t\r\n\f]
->\s
[^ \t\r\n\f]
->\S
\e
->e
(remove unnecessary escape)- …
See TODO item, optimizer lives in src/optimizer.
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
How to write an optimizer — ppci 0.5.9 documentation
To implement an optimalisation, the ppci.opt.transform.ModulePass must be subclassed. For this example, ppci.opt.transform.InstructionPass will be used.
Read more >Optimization - Hugging Face
The .optimization module provides: an optimizer with weight decay fixed that can be used to fine-tuned models, and; several schedules in the form...
Read more >The Optimization Module User's Guide
COMSOL products. This guide is a supplement to the COMSOL Multiphysics. Reference Manual. In this section is a short Optimization Module Overview.
Read more >Optimization - webpack
Tells webpack which algorithm to use when choosing module ids. Setting optimization.moduleIds to false tells webpack that none of built-in algorithms should ...
Read more >How to use Pytorch as a general optimizer | by Conor Mc.
Next, let's define the model and the training loop: class Model(nn.Module): """Custom Pytorch model for gradient optimization. """ def __init__( ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Keep in mind that the
u
flag (or the combination of theu
andi
flag) impacts some of these transformations.Closing this one since the module is set up. Other specific transforms can be implemented in separate issues.