Skip to content

Instantly share code, notes, and snippets.

@robclancy
Created October 16, 2013 01:43
Show Gist options
  • Save robclancy/7001399 to your computer and use it in GitHub Desktop.
Save robclancy/7001399 to your computer and use it in GitHub Desktop.
How to get banned in ##php
[02:27:49] <Robbo_> is there a phpmin of some sort?
[02:27:56] <Robbo_> so I can speed up compile time
[02:27:56] <boingolov> ?
[02:28:10] <Robbo_> white space makes compile time take longer
[02:28:21] <retran> LOL
[02:28:25] <boingolov> Robbo_: use apc or zend
[02:28:34] <Robbo_> do they minimize?
[02:28:43] <boingolov> Robbo_: they have byte code caching
[02:28:44] <Sazpaimon_> boingolov, it can vary, they're calls to imagemagick and tesseract
[02:28:57] <GoogleGuy> boingolov: Here's where exec can return with a failed code http://lxr.php.net/xref/PHP_5_5/ext/standard/exec.c#81 and here's one of the potential allocation failures it traces back to http://lxr.php.net/xref/PHP_5_5/TSRM/tsrm_win32.c#535
[02:28:57] <Robbo_> but why cache the white space at all?
[02:28:58] <Ant0nio> Hello how can i fix it where it see a folder lowercased? eg: Demo = demo
[02:29:00] <boingolov> Sazpaimon_: why not use the imagemagick lib directly?
[02:29:15] <boingolov> also, if they're long running processes, might be better to do them in a queue asynch
[02:29:26] <Sazpaimon_> the software I'm using doesn't support it
[02:29:33] <Sazpaimon_> otherwise I totally would
[02:29:42] <Sazpaimon_> same with tesseract
[02:30:00] <Robbo_> so there is no phpmin?
[02:30:10] <boingolov> Robbo_: no need for it
[02:30:16] <Robbo_> yes there is
[02:30:27] <GoogleGuy> Robbo_: What makes you think there is?
[02:30:35] <Sazpaimon_> anyway, fpm is set to the dynamic pm, 20 start_servers, 5 min_spare_servers, 35 max_spare_servers and 500 max_requests
[02:30:37] <Sazpaimon_> hmm
[02:30:39] <Robbo_> because white space will slow down the compile time
[02:30:42] <Sazpaimon_> that max_requests seems a little low
[02:30:54] <GoogleGuy> Robbo_: How did you come to that conclusion?
[02:30:56] <Robbo_> like with javascript
[02:30:59] <Robbo_> that is why there is jsmin
[02:31:00] <Sazpaimon_> oh and 75 max_children
[02:31:17] <boingolov> javascript min is useful because the code is transferred to the client before being executed
[02:31:21] <GoogleGuy> Robbo_: That's not why there is a jsmin
[02:31:23] <boingolov> so smaller payload = faster load time
[02:31:26] <Robbo_> yes it is
[02:31:28] <Robbo_> see
[02:31:31] <Robbo_> no whitespace == faster
[02:31:36] <GoogleGuy> Robbo_: jsmin is to save bandwidth, not compile time
[02:31:37] <jnewt> fwrite($socket,'\r\n'); sends '\\r\\n'
[02:31:48] <Robbo_> it's hard to code php with no whitespace though
[02:31:49] <jnewt> what's with the extra slashes?
[02:31:50] <Robbo_> so I need phpmin
[02:31:53] <Sazpaimon_> jnewt, don't use single quotes
[02:32:08] <Sazpaimon_> if you wanna send control characters, use double quotes
[02:32:12] <boingolov> Robbo_: google how apc works
[02:32:22] <Robbo_> I don't want to cache, I want to remove whitespace
[02:32:28] <Robbo_> I already use apc
[02:32:30] <GoogleGuy> Robbo_: You're confused. jsmin has absolutely nothing whatsoever, at all, to do with improving the performance of the javascript parser.
[02:32:40] <Robbo_> yes it does
[02:32:54] <boingolov> Robbo_: apc opcode / bytecode caching does remove whitespace
[02:33:00] <GoogleGuy> Robbo_: No, it doesn't. It has to do with saving the time it takes to transfer the javascript code over the network.
[02:33:03] <Robbo_> oh
[02:33:08] <Robbo_> so it has built in phpmin?
[02:33:11] <boingolov> it's already compiled
[02:33:11] <Sazpaimon_> i mean Robbo_ you're still wrong, but if you want to strip whitespace and comments from your code, php -w will do it
[02:33:11] <GoogleGuy> Minifying is about bandwidth.
[02:33:21] <boingolov> so it compiles the source once
[02:33:29] <Robbo_> well then I should do phpmin to save bandwidth?
[02:33:30] <Sazpaimon_> I also have no idea why php -w exists to begin with
[02:33:31] <boingolov> the compile stage removes the extra whitespace and comments
[02:33:37] <boingolov> Robbo_: no
[02:33:55] <Robbo_> guess ill have to talk to someone smarter
[02:33:55] <GoogleGuy> Robbo_: PHP code doesn't get transferred over the network to the client.
[02:33:57] <Robbo_> you guys don't get it
[02:34:01] <GoogleGuy> Robbo_: It runs locally on your server.
[02:34:10] <Robbo_> then why do you go to index.php etc?
[02:34:18] <GoogleGuy> ...
[02:34:20] <boingolov> Robbo_: live long and propser
[02:34:22] <ss23> 14:31:43 < Robbo_> no whitespace == faster
[02:34:25] <GoogleGuy> You have to be trolling at this point.
[02:34:26] <ss23> That's the incorrect assumption here
[02:34:29] <ss23> JusT FYI :)
[02:34:35] <Robbo_> ss23: how?
[02:34:37] <Sazpaimon_> ss23, nope
[02:34:40] <Robbo_> the compiler has to do less
[02:34:43] <Robbo_> so it will be faster
[02:34:44] <Sazpaimon_> everyone knows python is the slowest language ever
[02:34:48] <ss23> Robbo_: Complier doesn't run if you use APC etc
[02:34:49] <ss23> lol Sazpaimon_ XD
[02:34:50] <boingolov> Robbo_: when using apc, the compile happens once
[02:34:52] <Robbo_> python sucks
[02:34:55] <boingolov> not every time the page is hit
[02:35:05] <Robbo_> yeah but what if I can't use apc?
[02:35:08] <GoogleGuy> Well, the compiler does. It's just the parser that has to do less work.
[02:35:13] <boingolov> Robbo_: then you need to use zend
[02:35:23] <ss23> Robbo_: Still an incorrect assumption in reality
[02:35:25] <retran> you dont "need to use zend"
[02:35:33] <ss23> Robbo_: Because it won't hit the file system, the whitespace is neglible
[02:35:39] <Robbo_> in reality we use jsmin and cssmin why doesn't php get one to speed up its compiling?
[02:35:47] <relipse> should I use a form library or just get started into <form
[02:35:56] <boingolov> Robbo_: because php code isn't transferred to a web browser
[02:35:58] <ss23> Robbo_: Because the whitespace doesn't affect the compliation speed at all in reality
[02:36:00] <GoogleGuy> Because it has nothing to do with speeding up compiling?
[02:36:07] <Sazpaimon_> let me explain this better
[02:36:09] <ss23> Robbo_: I think you misunderstand the purpose of jsmin etc
[02:36:11] <Robbo_> then why use it at all?
[02:36:12] <GoogleGuy> whitespace is ignored by the lexer.
[02:36:19] <Sazpaimon_> so, with javascript and css, the actual source code of your script is sent to the browser
[02:36:19] <ss23> Robbo_: You *don't* use it for PHP :P
[02:36:20] <ss23> Robbo_: That's the point
[02:36:22] <Sazpaimon_> in its entirety
[02:36:42] <GoogleGuy> We already told you why. For saving on bandwidth since js and css are transferred over the network to the client.
[02:36:47] <Sazpaimon_> the reason you minify css and javascript, is because the transfer time of that source code is smaller
[02:36:47] <Robbo_> so PHP is smaller than js so you don't use as much bandwidth and it goes fast enough or someting?
[02:37:01] <Sazpaimon_> with php, the source code of your php script is not sent to the browser
[02:37:02] <ss23> Robbo_: No, bandwidth isn't an issue for PHP, since it's not sent to the client
[02:37:03] <GoogleGuy> Loading 100K lines of JS with 2 less bytes per line means you save 200KB / request
[02:37:16] <Sazpaimon_> it is interpreted and executed on the remote server itself
[02:37:19] <GoogleGuy> Multiply by 10 million requests /day and you're saving GBs of bandwidth.
[02:37:21] <Robbo_> this is so confusing
[02:37:24] <Robbo_> all I want is a phpmin
[02:37:26] <Robbo_> someone make me one?
[02:37:29] <ss23> Robbo_: There is no reason *for* one
[02:37:34] <Robbo_> yes there is!
[02:37:39] <boingolov> Robbo_: make it yourself, because nobody else is going to build one
[02:37:41] <retran> they have php code transformers
[02:37:46] <ss23> Robbo_: If there is one, no one in the world apart from you knows what it is :P
[02:37:48] <boingolov> anyone capable of building phpmin knows better than to build phpmin
[02:37:49] <Robbo_> this channel is stupid
[02:37:51] <Sazpaimon_> technically there already is a php minifier
[02:37:54] <Sazpaimon_> it's php -w
[02:37:56] <ss23> Robbo_: As such, since no one knows what it would ever be for, I doubt anyone could make it
[02:37:59] <Sazpaimon_> it serves no real purpose
[02:38:04] <Robbo_> oh so php has it
[02:38:05] <ss23> Robbo_: (Rather, I doubt anyone else could make it)
[02:38:07] <Robbo_> means it is a real thing
[02:38:08] <Robbo_> to help!
[02:38:12] <ss23> Robbo_: No... that was a joke
[02:38:27] <Robbo_> ill just make it myself
[02:38:28] <ss23> Robbo_: Like...
[02:38:29] <ss23> >.<
[02:38:39] <retran> a fools errand
[02:38:39] <ss23> Robbo_: That's fine, perhaps you could write a blog post detailing why you did it after too
[02:38:41] <Robbo_> since im clearly better than you
[02:38:50] <GoogleGuy> clearly
[02:39:03] <ss23> GoogleGuy: are you still an op, btw?
[02:39:05] <Sazpaimon_> Robbo_, 7;/10
[02:39:08] <Sazpaimon_> *7/10
[02:39:11] <Sazpaimon_> you had me going for a bit
[02:39:13] <boingolov> Robbo_: and for bonus points, post to reddit /r/programming
[02:39:13] <Robbo_> Sazpaimon_: aww come on
[02:39:16] <Robbo_> at least an 8
[02:39:20] <boingolov> and /.
[02:39:30] <boingolov> /. is full of caring nurturers
[02:39:33] <Sazpaimon_> you had me going
[02:39:34] <Ant0nio> is it posibble to make web read mixed cased letters?
[02:39:37] <Sazpaimon_> really, yo did
[02:39:42] <GoogleGuy> ss23: I never was an op here.
[02:39:44] <ss23> Ant0nio: What does "web" mean in this context?
[02:39:50] <ss23> GoogleGuy: Oh... I thought you were! No problems
[02:39:50] <Sazpaimon_> but I'll give you an extra point because you made everyone else mad
[02:39:52] <Ant0nio> website
[02:39:53] <Robbo_> it all comes because someone I know had their lead tell them not to use whitespace because it speeds up compile time
[02:40:04] <ss23> cythrawll caffinated MAKE ME AN OP WE NEED MORE OPS PLS
[02:40:14] <boingolov> Robbo_: lol
[02:40:18] <Robbo_> I tried this in #go-nuts btw and they picked I was trolling instantluy
[02:40:19] <Robbo_> you guys fail
[02:40:26] <Robbo_> :p
[02:40:29] <ss23> Robbo_: You underestimate the kind of people here
[02:40:36] <Sazpaimon_> while the subject is still up
[02:40:38] <GoogleGuy> Just stop feeding the trolls people
[02:40:40] <Robbo_> Oh no, I didn't, that's why it was my next target
[02:40:40] <Sazpaimon_> what IS the point of php -w
[02:40:48] <ss23> Robbo_: (That is, you underestimate the kind of stupid people that come here, and b) how helpful we try be)
[02:40:49] <Robbo_> and yes LMFAO at php -w existing!
[02:40:54] <Ant0nio> eg: blah.com/user/DemO still read | blah.com/user/demo
[02:40:59] <retran> that's rude Robbo
[02:41:02] * cythrawll sets mode: +b $a:Robbo_
[02:41:18] * Robbo_ was kicked by cythrawll (Robbo_)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment