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

Split DefaultRules into deparate files #316

Open
dkarlovi opened this issue Sep 8, 2022 · 0 comments
Open

Split DefaultRules into deparate files #316

dkarlovi opened this issue Sep 8, 2022 · 0 comments

Comments

@dkarlovi
Copy link

dkarlovi commented Sep 8, 2022

Currently, when you use the default rule provider, it loads into memory fully. This means all the rules are loaded each time, even though it's very unlikely you'll require all of them.

A better approach would be to generate one file per rule and use that to wire the rules on demand, probably using autoloading.

I've found this issue using meminfo on my app and it pointed me toward chinese rules which I don't use in my app.

Example output:

Path from 0x7fccf18bc600
+----------------------+
| Id: 0x7fccf21c24c0   |
| Type: array          |
| Size: 72 B           |
| Is root: No          |
| Children count: 6933 |
+----------------------+
         ^          
         |          
      chinese       
         |          
         |          
+--------------------+
| Id: 0x7fccf3d3e5a0 |
| Type: array        |
| Size: 72 B         |
| Is root: No        |
| Children count: 38 |
+--------------------+
         ^          
         |          
       rules        
         |          
         |          
+-------------------------------------------------------+
| Id: 0x7fccf3d3e578                                    |
| Type: object                                          |
| Class: Cocur\Slugify\RuleProvider\DefaultRuleProvider |
| Object Handle: 959                                    |
| Size: 72 B                                            |
| Is root: No                                           |
| Children count: 1                                     |
+-------------------------------------------------------+
         ^          
         |          
      provider      
         |          
         |          
+------------------------------+
| Id: 0x7fccf39ab120           |
| Type: object                 |
| Class: Cocur\Slugify\Slugify |
| Object Handle: 886           |
| Size: 72 B                   |
| Is root: No                  |
| Children count: 3            |
+------------------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant