GithubHelp home page GithubHelp logo

Comment stripping from files about phar-util HOT 3 CLOSED

koto avatar koto commented on August 16, 2024
Comment stripping from files

from phar-util.

Comments (3)

koto avatar koto commented on August 16, 2024

There's a potential incompatibility if files packages in Phar archives use meta-programming to get code configuration from inside comments (it's rarely used, but could be). Still, this would trim down the size like you said. Give it a go if you have time.

from phar-util.

katanacrimson avatar katanacrimson commented on August 16, 2024

As noted in the issue reference regarding 65916ac, I'm taking a swing at this now. Looking at using php_strip_whitespace() specifically, as it shouldn't matter how code is formatted. Feature is set to default to off, as well.

@koto, how's it look to you atm?

Once I test it out and make sure it works, I'll open up a pull request.

Also, apologies for the reference spammy. Accidentally committed on master.

ED: Relevant branch here: https://github.com/damianb/phar-util/tree/feature-stripcmts

from phar-util.

katanacrimson avatar katanacrimson commented on August 16, 2024

Did another commit after I tested it (and found zero effect, no stripping was actually occurring with that first commit!), and I've got a before-and-after on a project of mine where I use phar-build.

Take a look at yukari.phar, the Yukari core (it includes the OpenFlame DBAL and the OpenFlame Framework, plus the submodules for emberlabs\materia and yukari\core).
Also ignore the chown/chmod, it's an NTFS partition mounted in my linux distro. ;)

obsidian@lithion ~/code/yukari/main $ ls -lAh lib/
total 329K
drwxrwxrwx 1 root root 4.0K 2011-10-31 14:19 addons
-rwxrwxrwx 1 root root 314K 2011-11-01 20:30 yukari.phar
-rwxrwxrwx 1 root root  272 2011-11-01 20:35 yukari.phar.pubkey

Now, by setting the Yukari makefile to strip files matching the space delimited regexp set of .php$, we get this:


obsidian@lithion ~/code/yukari/main $ ls -lAh lib/
total 161K
drwxrwxrwx 1 root root 4.0K 2011-10-31 14:19 addons
-rwxrwxrwx 1 root root 153K 2011-11-01 20:35 yukari.phar
-rwxrwxrwx 1 root root  272 2011-11-01 20:35 yukari.phar.pubkey

Nearly a 53% savings in filesize.

I've yet to perform a test to see if everything runs fine however, that's next for me to do. Need to finish my chem homework before I take a whack at that however.

from phar-util.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.