Merge pull request #11 from jawira/8-remove-comments

Remove comments to improve op_cache performance in production environments
This commit is contained in:
Jawira Portugal 2020-09-17 10:45:14 +02:00 committed by GitHub
commit 728e1a954b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 45 additions and 19846 deletions

3
.gitattributes vendored
View File

@ -6,3 +6,6 @@
/resources export-ignore /resources export-ignore
/build.xml export-ignore /build.xml export-ignore
/build.png export-ignore /build.png export-ignore
/CONTRIBUTING.md export-ignore
/README.md export-ignore
/CHANGELOG.md export-ignore

View File

@ -11,6 +11,10 @@
## Unreleased ## Unreleased
### Changed
- [#8] Cleaning Emoji class removing comments, from 468K to 157K.
## [v2.0.0] - 2020-03-12 ## [v2.0.0] - 2020-03-12
### Changed ### Changed
@ -43,7 +47,7 @@
- [#2] Constant `Emoji::FLAG_WALES` was changed to `Emoji::FLAG_GBWLS`. - [#2] Constant `Emoji::FLAG_WALES` was changed to `Emoji::FLAG_GBWLS`.
## [v0.0.0] - 2019-08-30 ## [v0.0.0] - 2019-08-30
[!6F(t#}P9Uyq&98
### Added ### Added
- First working version. - First working version.

BIN
build.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View File

@ -1,20 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<project name="Emoji catalog" default="diagnostics" phingVersion="3"> <project name="Emoji catalog" default="help" phingVersion="3">
<defaultexcludes default="true"/><!--Initializing default excludes--> <defaultexcludes default="true"/><!--Initializing default excludes-->
<defaultexcludes add="**/.idea"/> <defaultexcludes add="**/.idea"/>
<defaultexcludes add="**/.idea/**"/> <defaultexcludes add="**/.idea/**"/>
<property name="phing.http.proxy" value="${env.http_proxy}"/> <property name="phing.http.proxy" value="${env.http_proxy}"/>
<target name="diagnostics"> <target name="help">
<diagnostics/> <exec executable="xdg-open" spawn="true">
<arg path="build.png"/>
</exec>
</target> </target>
<target name="setup" description="Prepare project for dev" depends="diagnostics, composer:install, phing:visualizer"/> <target name="setup" description="Prepare project for dev" depends="composer:install, phing:visualizer"/>
<target name="qa" description="Quality assurance" depends="composer:validate, php:lint"/> <target name="qa" description="Quality assurance" depends="composer:validate, php:lint"/>
<target name="update" description="Update class and catalog" depends="emoji:update, catalog:update"/> <target name="update" description="Update class and catalog" depends="emoji:update, catalog:update"/>
<target name="emoji:update" description="Update Emoji.php" depends="emoji-list:download, emoji:parse, emoji:build"/> <target name="emoji:update" description="Update Emoji.php"
depends="emoji-list:download, emoji:parse, emoji:build, emoji:clean"/>
<target name="catalog:update" description="Update catalog.md" <target name="catalog:update" description="Update catalog.md"
depends="emoji-list:download, catalog:parse, catalog:build"/> depends="emoji-list:download, catalog:parse, catalog:build"/>
@ -23,6 +26,7 @@
<arg value="--no-interaction"/> <arg value="--no-interaction"/>
<arg value="--profile"/> <arg value="--profile"/>
<arg value="--strict"/> <arg value="--strict"/>
<arg value="--quiet"/>
</composer> </composer>
</target> </target>
@ -91,6 +95,17 @@
<append file="resources/templates/emoji-footer.php.dist" destFile="src/Emoji.php"/> <append file="resources/templates/emoji-footer.php.dist" destFile="src/Emoji.php"/>
</target> </target>
<target name="emoji:clean" description="Reduce Emoji.php size">
<reflexive file="src/Emoji.php">
<filterchain>
<stripphpcomments/>
<linecontainsregexp>
<regexp pattern="\S"/>
</linecontainsregexp>
</filterchain>
</reflexive>
</target>
<target name="catalog:parse"> <target name="catalog:parse">
<mkdir dir="resources/output"/> <mkdir dir="resources/output"/>
<delete file="resources/output/catalog-1.txt"/> <delete file="resources/output/catalog-1.txt"/>

View File

@ -4,7 +4,18 @@ Dev notes
Update emoji class Update emoji class
------------------ ------------------
1. Run `phing update` and see if you had new emojis (you can see differences with `phing emoji:count`) 1. Run `$ phing setup update qa` and see if you had new emojis (you can also use
2. Update Readme (e.g. file badge) `$ phing emoji:count` before and after update)
3. Update changelog 2. Be aware that emojis can change its name without reason (ex: DIRECT_HIT →
4. Create a tag (version should be the same as Emoji unicode) BULLSEYE). This forces me to publish a major version 👎.
3. Update Readme: badges, emoji count, ...
4. Update CHANGELOG.md
Cleaning Emoji.php
------------------
Emoji.php is generated with descriptive comments for each constant.
The comments are striped later to [avoid impacting OP_CACHE in production
environments][issue-8].
[issue-8]: https://github.com/jawira/emoji-catalog/issues/8

File diff suppressed because it is too large Load Diff