-
-
Notifications
You must be signed in to change notification settings - Fork 386
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
fix: speed up Lang.pm initialization, save 2 seconds x 100 tests #9197
Conversation
Kudos, SonarCloud Quality Gate passed! |
= ProductOpener::I18N::split_tags(ProductOpener::I18N::read_po_files("$data_root/po/tags/")); | ||
%tag_type_singular = %{$tag_type_singular_ref}; | ||
%tag_type_plural = %{$tag_type_plural_ref}; | ||
$path = "$data_root/data/Lang_tags.${server_domain}.sto"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more cache data, could you move it to the cache folder.
@@ -48,6 +49,7 @@ | |||
mkdir("$data_root/data", 0755) or die("Could not create target directory $data_root/data : $!\n"); | |||
} | |||
store("$data_root/data/Lang.${server_domain}.sto", \%Lang); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here also it would be better to have it in a cache folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, I am just a bit picky about using a cache directory instead of a data directory (help to better identify what to backups, be redundant, etc.)
Let's do it once the migration is done. In fact /data was intended to be a "cache" folder in the sense that it contains things that can be recomputed. We should revisit those things globally. The built lang files are more like the built taxonomies, we could just use the same system we have for taxonomies. |
This is an attempt to speed up tests. Almost all tests load Lang.pm.
In profiling done with nytprof, this saves about 2 seconds per initialization. As we have 100 unit + integration tests, I'm hoping this should save 3 minutes when running all tests.