« first day (1598 days earlier)      last day (3350 days later) » 

9:00 PM
@ircmaxell yeah, okay. But these are more rarely touched I think. Anyway, never had to change opcaching part for what I did. (except when I removed IS_CONSTANT_ARRAY and added IS_CONSTANT_AST … but that were a few precise minor changes)
 
yeah, it's just interesting because we've done different thigns
 
Yes.
But opcaching part is not so complicated, AFAIK.
 
it's not that it's complicated, it's that there's a bunch of duplication and hacks because it's in an extension rather than integrated
the string interning part was the worst I ran into (I forget what I was doing, but it was a PITA to work around with opcache)
tho with 7 that's likely better
 
@ircmaxell Hold on, there's no popcorn on this flight. What am I supposed to snack on during this latest bout of drama?
 
@Sara I can make more drama if you'd like for the next reply ;-)
 
9:06 PM
You're like the Santa of PHP-Drama-As-Gift
 
@ircmaxell But Optimizer is partly a lot of condensed code… or how Dmitry put it:
> Agree. It has to be refactored, but splitting into functions won't make it more readable. If you would look into lexer code, you won't find it readable at all because it's machine generated code for token recognition. The big part of optimizer is "optimization patterns recognition".
 
I don't know about that
most of that is "pattern recognition code", but that doesn't mean it needs to be a single 500 line function
 
yes, this
 
and that doesn't mean there can't be generic hooks to the CFG
so that other extensions can do more complex optimizations (function inlining, global-value-numbering, etc)
 
I need to say: I just don't know. I have not enough experience to tell whether splitting into functions helps a lot here.
 
9:08 PM
And yes, I agree, optimizer and cache should be separate
 
914        } else if ((opline->opcode == ZEND_CONCAT ||
915                    opline->opcode == ZEND_ADD_STRING ||
916                    opline->opcode == ZEND_ADD_CHAR) &&
917                  ZEND_OP2_TYPE(opline) == IS_CONST &&
918                  ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
919                  VAR_SOURCE(opline->op1) &&
920                  (VAR_SOURCE(opline->op1)->opcode == ZEND_CONCAT ||
921                   VAR_SOURCE(opline->op1)->opcode == ZEND_ADD_STRING ||
922                   VAR_SOURCE(opline->op1)->opcode == ZEND_ADD_CHAR) &&
 
They definitely should be separate. Yes. I suggested to put it into /Zend, because it's so close to engine.
 
^^ that's pattern recognition, but also eih...
with macros or inline functions, that could be cleaned up a bit
and I think comparing a hand-built optimizer to a machine generated lexer is a bit missing the point...
 
@ircmaxell yep… But this big pattern recognitions don't help me giving an idea where I need to jump in when I want to add something.
@ircmaxell yeah, machine-generated lexer has a lot of states, jump tables etc. but code feels a bit alike.
 
but it's generated vs written code
generated code can be dirty, because it doesn't need to be clean (just regenerate it)
written code needs to be clean because it requires a human to maintain it
 
9:14 PM
where the issue is.
 
interesting, it does some constant propagation: lxr.php.net/xref/PHP_TRUNK/ext/opcache/Optimizer/…
 
Which is obsolete with PHP 7 now.
because PHP 7 does it now itself at compile time…
 
I should put my optimizr extension up.
 
@Sara which does what exactly?
 
It's a big visitor implementation, let's you rewrite the ast
Doesn't do anything impressive yet hough, si I've been sitting on it.
Wanted to try a different implentation using a pluggable cfg, but who has the time?
Maybe I'll get to it this week while I'm in Boston
 
9:21 PM
@Sara yay to the CFG
@bwoebi it does?
 
@Sara you're in Boston?
 
In a couple hours I will be
 
Oh awesome!
 
on the plane now?
 
Technically speaking I'm in Iowa atm
 
9:22 PM
I work on Summer Street (right downtown)
 
Yeah, yay for gogo
 
s/in/over/
 
:)
 
@bwoebi so if I do: $c = 1 + 2; that'll get optimized to $c = 3;?
 
9:25 PM
yes
 
or only in constants and other areas like that (member variable declaration, etc)
 
everywhere.
 
Thoe are the easy optimizations
 
it does that by iterating over the entire oparray looking for constant expressions, cool
 
@ircmaxell or e.g. constant substitution where possible
 
9:26 PM
ya
 
My optimizr extension also goes to the extent of $x = foldableFunction(constantExpression) => $x = calculatedConstantResult
 
@ircmaxell It's AST based?
 
Which was fun to implement
 
no oparray, ast... sorry
@Sara awesome!!!
do you do global value numbering as well? Or constant propagation?
 
I'm also doing if (knownTrueOrFalse) { then(); } else { else(); } => ifBlock or elseBlock folding
Yeah, const propagation, of couse
 
9:27 PM
@NikiC I see your point... I'll add some regression tests for this case and do the checks.
 
nice :-)
did you actually implement a SSA step?
 
No, it got messy when I tried
Which is part of why I wanna restart with a CFG framework
 
then how did you do constant propagation?
 
persistent consts only :p
 
ahhhh
 
9:28 PM
Oh, you meant const assignments
no, not that
 
I was thinking: $a = 1; $b = 2; $c = $a + $b; -> $c = 3;
 
Yeah, no. That was going to be post-SSA, but, as said
 
yeah. SSA was one of the hardest things to implement I found...
 
I got to the point where I'm like, "I can do this better now that I've thought a bunch of this through"
So I'm going to build something that will build out a call graph, then recollapse it to AST for compilation, and pluggable optimizatios in the middle
 
so I'll be honest, I'm debating building a tracing JIT for the VM
 
9:30 PM
@ircmaxell I'm half tempted too
Somewhat subversive, given my paid project, but yolo
 
yeah, I'm debating doing that as a primary project for a little while...
 
(we'll end up with php-src always faster than hhvm…)
 
No interest in working on Zend's "JIT"? snicker
 
being tracing based, shouldn't be nearly as complex as a local compiler (no SSA or CFG to worry about)
 
@bwoebi Don't count on it, we're got lots of low-hanging fruit to pick yet.
 
9:32 PM
@bwoebi the man-hours of engineers that they have... no way, won't happen. Especially since they have compiler experts on hand doing the optimizations...
 
@ircmaxell It'll be a fun race though. :)
 
yup, and everyone will win
 
I'm digging all this perf talk on internals@, even if it's not-entirely-accurate all the time
 
@Sara the fact that they continue to call it that, and cite the results really is either showing that they don't understand, they don't care, or they are intentionally misleading people. All of which bothers me
 
I'm going to assume the former until proven otherwise
 
9:34 PM
definitely, but that still bothers me... Whatever tho :-)
@NikiC don't do it man!
 
@NikiC DANGIT. When you say "We currently don't support any language constructors in constants I think, but that's just because they don't happen to be implemented, we may want to add them in the future" you mean, ANY expression?
The current array situation is quite easy to fix with no perf issues or drawbacks, but if we plan to allow any expression on constants then better I drop the voting and try to make the lexing feedback without break ext tokenizer or some other alternative for PHP7.1 :D
 
9:51 PM
I wonder if we could/should support a binary format for pre-compiled applications. Something that we can skip the parsing step and insert AST directly (or perhaps opcode)
something like a sqlite database of compiled files, or something like that
 
Could: Yes. Should: Maybe not. Sets bad expectations about (non-)recoverability of code.
 
Like phar, but with the ability to run it through heavy optimizations?
 
Though it would allow deeper optimization. HHVM does it for that reason.
 
well, was thinking along the lines of doing ahead-of-time analysis
 
@ircmaxell one advantage of optimizations all in Zend would be being able to a) not spread out op_array manipulation everywhere and b) we have less redundant iterations. Currently we sometimes end up calling zend_eval_const_expr() multiple times for a same AST node. Also, we have e.g. constant operations now in compile step and in opcache. If we had every optimization locally in Zend, that'd be much structured and less redundant
 
9:56 PM
yeah, hh_client, right?
@bwoebi yeah, that's fair
for those types of optimizations anyway
 
@ircmaxell hrm? hh_client is the typechecker
 
@ircmaxell you're aware you're just proposing to put opcache data into file format instead of shared memory? With a bit of chance, it'd even not be so much work…
 
@Sara don't you generate a sqlite db from something ahead-of-time? I thought I remember that from an early talk you gave
 
Yeah, it's "RepoAuthoritative" mode
 
@bwoebi and we could even easily implement other patterns?
 
9:58 PM
@bwoebi perhaps. Not sure if opcode level or if AST level. just something like that
@Sara yeah, that's the one
 
20%+ perf bump atm iirc
 
@nikita2206 other patterns of what? other types of Optimization or what?
 
@Sara that just from stat reduction? Or other gains as well?
 
@bwoebi yes, other types of optimization
 
@ircmaxell I don't see where it'd make sense to retain the AST.
 
10:00 PM
((A lot of it is stat, yeah))
But there are deeper opts
 
@nikita2206 yeah eventually. Should be then be just switchable by e.g. an ini setting for optimization level.
 
My favorite hack was Lighttpd + FAM + FastCGI + xcache. I could serve 2k req/sec to static files while serving 200 req/sec to PHP without ever issuing a single stat call to disk
FAM == File-Alteration-Monitor, a kernel module which notifies listeners about changes to file structures. So you can stat cache indefinitely, but the second you write to disk the cache is invalidated.
 
you mean FPM… or what is FAM? … ah.
 
Using inotify, I expect
 
@Sara it predates inotify
 
10:02 PM
Oh, alright then
 
but yeah, for local fs, it's identical to the funcitonality provided by inotify
but FAM also worked on NFS mounts (where inotify does not)
when I ran that setup, it was 2005 on a 5 year old machine. Apache wouldn't even hit 100 req/sec for static files...
:-)
It was a shame that Jan lost time to work on lighttpd. It was an awesome project. IMHO better than nginx at the time. Certainly faster and easier to configure...
 
wiki.php.net/rfc/consistent_function_names … does … he … even realize that some function names just are weird?
> str_cmp → strcmp
str_ncmp → strncmp
str_case_cmp → strcasecmp
str_ncase_cmp → strncasecmp
str_nat_cmp → strnatcmp
str_nat_case_cmp → strnatcasecmp
wat.
There is a general rule… if both on sides are abbreviations, you omit the underscore...
 
eew!
 
There is consistency… but Yasuo just doesn't realize it…
 
eih
 
10:13 PM
eih!
 
@ircmaxell hmm, I've voted in an hour? :)
 
I agree that some could be renamed… but well… not that.
 
I think there's no point in renaming that stuff
 
@bwoebi Doesn't even need to be in core.
 
The gd_ prefix seems somewhat useful ..
 
10:16 PM
I'd much rather solve the few cases where needle and haystack are wrong (array_key_exists vs property_exists for example) than worry about naming.
 
I'd rather leave the damn functions alone.
Like.. fuck it. Use google. Job done.
FTFY
 
@Ja͢ck as said, there are a few thing which could be renamed (like gd_ prefix) or… virtual() -> apache_virtual_req() … or these gettext() funcs…
 
@Sara s/google/your IDE/, but yes. Doesn't stop either from being a papercut.
 
Yeah, the rest is shred worthy.
 
@Charles Develop callouses?
 
10:20 PM
@Sara More like scar tissue.
 
:D
 
"array_in → in_array" … waaaah… I'm really scared now.
2
 
haha
If anything, array_contains($haystack, $needle, ...) would be a more logical choice (imo)
 
10:34 PM
Guys I need some advices, what the best way to insert data into a db via post back.
Currently I insert for each post request, but I experience deadlock issuses when the data is large more than 10K.
I am aware its not efficient , I thought about writing to a file first
 
> We should really consider Nikita's experiment instead,as it acutally
brings some big plus.
What is Pierre referring to?
 
@bwoebi scalar methods I'd bet
 
Ah
 
I'm far more likely to support scalar methods
 
I don't care for it
 
10:36 PM
Could be worth a try… not sure yet… I'd first like to see how that looks in real real world code…
 
but yeah, better than renaming 1000 functions
 
@AhmedDaou For a similar problem what i did was to i) create a temp table when processing the upload. ii) insert all the rows into that table iii) when the all the rows are inserted, do a single insert into the real table with a select from the temp table. Doing a single insert....from is much faster than doing a lot of individual inserts.
 
@ircmaxell apropos of nothing, your avatar looks grumpy at low res
 
/me isn't grumpy.
 
@Sara really? :o
 
10:38 PM
I know, just your image
 
@Danack yes I thought about this also, but what is the difference, You are still inserting in the temp one by one right
 
Maybe it's just me.
 
yeah, I need a new picture. The old one doesn't do the hair justice
 
Mine doesn't work well at low res either
 
yours looks like you're doing half of an egyptian dance
 
10:40 PM
yeah
 
@AhmedDaou Yes, but it avoids locking the main table during the insert of the individuals rows. When you transfer the data from the temp table to the main table, almost all SQL engines are far more efficient at doing a single internal transfer, than they are doing lots of individual transfers, due to not having to communicate with the outside world and not being able to update the index updates.
 
weirdly, I basically was, kinda
but my flight is landing, so ttyl
 
the large version makes you look like you're pontificating
safe landing!
 
@Danack Yes definetly you are right, I notice this happens on updates not inserts
@Danack I will use temp table, but what about connections, do you open or close them mfor each request, or is it something better for handling db connections such as a singleton class
or this should not be a concern?
 
@NikiC ok, found a solution that won't bork the expression assignment on constants :P but I don't like this tension every time we think about a possible feature :s lexing feedback is the only solution without possible future issues on the long run.
 
10:47 PM
@AhmedDaou Most of the PHP libraries don't require the connection to be closed, they will handle that in the background and allow them to be re-used where possible. I prefer to use a dependency injection rather than a singletone to pass the connections into the code that needs them.
 
@Danack thank you for your advices
 
11:01 PM
Kittens and ducklings; does it get any cuter?
 
11:26 PM
Our main vendor's site is CFM. One of their side sites is running Apache + PHP on Windows, with .inc files.
I never had reason to trust our main vendor, and now I'm actively afraid of them.
 
Anyone who dabbles in cold fusion should be feared.
 
@Ja͢ck Perhaps this is why I am known as the dictator. I dabbled with cold fusion in my early days.
 
or has been around and maintaining for 15 years and should be respected for surviving with consistency
... that's not entirely joking. Mostly, but not entirely.
 
PHP is surviving for 20 years with inconsistencies ;-)
Though, that's arguably the easier thing to accomplish heh
 
@VeeeneX The point is that when A is composed of B an A is not a B but an A has a B. Read that a few times slowly to make sure you get it.
Composition: A has a B.
Inheritance: A is a B.
 
11:31 PM
Own the B, or B the B!
 
@Ja͢ck and I'd never even joke about respecting it :p
 
@rdlowrey How goes the certificate regeneration?
 
@Ja͢ck got a bit WTFy there when it got to the ducks nursing
 
user895378
11:46 PM
@LeviMorrison fine. I was about halfway through when I had to stop and write a long mail to internals about the generator delegation RFC. Did gym after that. Going to have some dinner and then resume cert stuff after food.
 
@PeeHaa I think you mean
oh, sonofa.... it killed my uppercasing the tag... dafuq
 
ha!
 
one more cv to go ... :) - aaand gn8
 
\o/
 

« first day (1598 days earlier)      last day (3350 days later) »