« first day (1659 days earlier)      last day (3304 days later) » 

1:00 PM
But $10 says that either way people will go "WTF PHP closures are broken because they do value/reference semantics" anyway :D
 
"I basically see either implementing automatic by-val capture or full closures" Why not both?
 
So just do market research on the discussions held in other languages and do what's right for your own ecosystem - just be sure to document and share all that reserach in the RFC.
 
@NikiC Well… I expect it intuitively to be like function() use (&$x, &$y) { $x &= $y; }
 
> it seems there are two different use cases.
i) You want to operate on the variables already defined - in which case you want them all to be available by reference automatically.
ii) You want to define a stand alone function that doesn't bind to any variables automatically.
 
Hum more research. Drowning in research
@Danack So ... [=]() {} and [&]() {} ? ^^
@bwoebi Can we implement real closures in a performant way?
afaik right now to share scope we need to rebuild the symtable
for eval/include etc
 
1:04 PM
rebuilding is necessary in any case.
 
is it?
 
yes. We need a symbol table, because, when the defining scope is exited, the Closure still must live
and compiled variables are freed when call frame is destroyed
 
yes, currently. I was wondering if there is some way to avoid this
but I guess sharing CVs is not possible
 
@NikiC not really.
@NikiC also, we can't avoid this because it's all allocated in one stack…
 
but okay, the only cost of the symtable should be memory (and creation/destruction), as the access is still via CV
 
1:07 PM
they'd be overwritten…
 
@NikiC did you see the v8 closures famous post?
 
@NikiC no. The issue is that CVs disappear when defining scope is exited
 
@BenjaminGruenbaum I don't think so
 
Grokking v8 closures, lemme find it
Not that up to date, still very good
 
@NikiC we'd spend a lot of time copying the CV contents back and forth up to a point CVs are actually slower than without
also, world will blow up when you put a yield in it…
 
1:09 PM
@bwoebi I'm referring to the accesses of the variables, which will still happen through CV even if a symtable is used
Ah bah
nevermind
 
yep…
These were the issues I ran into in my original implementation…
 
or actually no after all
let me check how we do symtable rebinds
 
@NikiC we copy zvals back and forth. (The values, not the indirects)
zend_attach_symbol_table
 
yes
what I expected
so cv access still works
we just have the overhead of a) creating the symtable and b) copying its values to a new CV table
 
@NikiC stop. The symbol table just contains IS_INDIRECT to the CVs of the defining scope.
so when defining scope disappears, we're in trouble
 
1:13 PM
@bwoebi yes
@bwoebi yes. I think we're talking past each other here
@BenjaminGruenbaum Thanks, bookmarked
 
@NikiC hmm… so?
 
Well, let me know if there is anything else I can contribute, I've used many languages and I understand closures in a few but I'm not really a great PHP expert to say the least.
 
@bwoebi I think I see what you mean now
 
yea…
 
How were you planning to deal with that?
When leaving the scope (if the symtable is used by a closure) move the cvs into the symtable?
 
1:19 PM
@NikiC Set a refcounter on symtable. If refcounter >= 2 upon CV free, fill the symtable with values. (not indirects) Also somehow mark whether the call frame was destroyed. If it wasn't, reattach. … That was my original plan… But...
Recursive calls on these closures go nuts with this.
 
hah
 
posted on May 02, 2015 by PeeHaa

This is a pre-alpha release of Minifine. Tests will be added in the future.

 
because we then reattach to the original calling frame, but not to the Closure call frames…
 
sounds fun
 
so, the only option were to always detach and reattach inside Closure op_arrays, whenever we do a fcall.
and this will end up with lots of attaching and detaching.
And then all hopes for perf are lost…
Other option would be to do that above… but don't use CV's in short closures, but always lookup the EX(symbol_table)
 
1:26 PM
@bwoebi uh
 
that'd save us all the reattaching and deattaching
@NikiC And add the CV's of the short closures to the defining scope call frame.
@NikiC IMO that'd be the most stable and efficient we can get at all here.
 
@bwoebi ah, maybe do something similar to generators and create a new vm stack page if short closures are used?
 
@NikiC … This would work for the CVs. But the temporary variables are also allocated on the same call frame than CVs…
which won't work well with recursion.
Also vm_stack pages aren't cheap
 
yes, temps are a problem
 
@NikiC Just note, that short lambdas will be probably mostly short code. It won't reuse variables a lot. With current lambdas we anyway have to do a lexical FETCH_W/R and ASSIGN(_REF). These ops now disappear and we'll have a very few additional lexical FETCH_W/R's, but without the ASSIGN. It'll, for short lambdas, probably be same perf than current closures with use (&$ref).
 
1:34 PM
@bwoebi with the "short" constraint we don't need any of this, by-value will suffice
 
@NikiC with short… I mean… lambdas usually don't have as much code as real functions do.
 
Without the "short" constraint, dropping CV optimization sounds rather precarious
 
@NikiC We'll have to try, I think.
 
just put a loop inside your lambda and already instead of that one FETCH/ASSIGN you have a FETCH on every iteration
 
hmm…
eih wait.
we can have the FETCH/ASSIGN on top for all CVs… and for other FETCH_* ops, we always use lexical fetches
could that work?
oh no.
now we have again the issue that we're operating on local vars…
forget that.
(I mean $x &= $y then won't affect defining scope)
 
1:40 PM
@bwoebi Yes.
 
@LeviMorrison As we discussed here… solution would be to wrap it like ($intial ~> {...})($initial)
 
Correct, which is what I would do anyway.
But for others that's just funky and extra complexity and error prone.
I think doing things by value is the best way based on the write-up I linked you last night.
 
@LeviMorrison Oh well… We talked about that for the last two hours… just scroll a bit up… chat.stackoverflow.com/transcript/message/23052366#23052366
 
I'm happy to hear more discussion points but so far we have "JavaScript does it by reference" which is, in my opinion, one more reason to not do it based on my experience and others' experience with that behavior being problematic in JS.
 
1 hour ago, by Benjamin Gruenbaum
Python, JS, C#, Scala, Dart, Ruby, lua, Go, all by reference.
not just JS… just read all the discussion above.
 
1:44 PM
Sure – why though.
 
> just read all the discussion above
@NikiC another problem with attaching/reattaching symtable is that we don't want the parameters to be shared.
they must be local variables.
and not leak back into defining scope.
 
@bwoebi I must be missing something because everything I just read describes a problem that doesn't exist if you capture by value :)
 
… so, I reiterate: sharing symbol tables blindly isn't an option either @NikiC … so we probably have to always fetch then. In case we want perfect closing over.
2 hours ago, by Benjamin Gruenbaum
PHP doesn't have value semantics/reference semantics as deep as C++'s, I think it'll confuse people if you make copies and they try to assign to a variable.
2 hours ago, by Benjamin Gruenbaum
$sum = 0;
$myThing->each(($thing) ~> $sum += $thing->stuff)
@LeviMorrison ^ basically that.
 
Sure.
 
You always can dereference references, but not rereference values.
 
1:52 PM
I get that.
 
# Also, I have to go now… will be back later.
 
Realize that in most functional languages it happens by value simply because their variables are usually immutable.
Or rather it doesn't matter if it is by reference or value since it can't be changed.
 
@LeviMorrison As long as you assume sole use in functional context.
 
I was just adding one more point to the discussion, that's all.
 
1 hour ago, by Benjamin Gruenbaum
@NikiC why do you think it's targeted at "obviously non-mutating functional code"? Very few people actually write that sort of code in the JS ecosystem and I assume even fewer do it in the PHP one.
 
1:54 PM
My experience with closures in PHP is that people who use them write functional code.
That may just be experience bias.
JavaScript is different because closures are essentially the building blocks for everything in JavaScript.
 
@LeviMorrison yup
@bwoebi So I'll just add "ugly and slow to implement" on the list of why by-value binding is better :P
 
@LeviMorrison people who write functional code don't mutate stuff so by reference is good for them too.
@NikiC nope, not really - it's not ugly or slow to implement - it's possible to implement closures in a pretty fast way.
 
@BenjaminGruenbaum Yep. I made a comment roughly like this a while ago. I honestly feel that by value is safer and better, but it won't really affect me if it's by reference except when explaining to people why their code doesn't work the way they want.
 
The only reason you'd care if you get it by value in a language like PHP (unlike a language like C++ with strong value semantics) is if you want to mutate it - and in that case functional code doesn't make sense anyway. If you're writing "less than perfect" functional code you probably want, or expect to be able to mutate it.
 
This is one reason I like use() – if it's by value or reference is explicit.
It's inconvenient, which sucks, but it is at least explicit.
 
2:06 PM
I don't get why you'd do anything different from every other language that does closures. Especially since mutating is a really common use case for closures.
Doing .forEach is very common, not to mention stuff like 10.times in Ruby which is idiomatic.
If you're not mutating anything, you don't really need closures in the first place, this is what Java does (only allows final variables in functional interfaces and anonymous inner classes) and everyone pretty much hates it.
It sounds like a good idea ™ to enforce less mutations and mutable state in the loose but there is a reason that Haskell is a lot less common than PHP as a language.
Also - closures aren't a building block in JS because of the lack of other building blocks - closures are a building block in pretty much every language that has them because they're so damn useful.
I have read plenty of C# code that utilizes closures, even for mutatation - lots of stuff like:
 
@BenjaminGruenbaum Uh, maybe you live in this nice world of modern JavaScript or a world where all your JavaScript developers are experts.
I don't know many in that world.
 
Retry(3).Do(() => {
    varFromClosure = SomeOpThatMightThrow(arg1FromClusre));
});
 
@LeviMorrison why? People do scopes with them all the time, passing functions is very useful, even the developers who have no idea what an array's map function use it all the time without realizing.
 
@BenjaminGruenbaum It seems to be with what we currently have to work with in PHP. Of course there should be a way to make it fast with enough effort. We just don't see it yet ;)
 
2:11 PM
They still do $.each for iteration, and they still use anonymous functions for event emitters and so on.
@NikiC I know absolutely squat about PHP engine internals (other than the stuff at ircmaxell's blog I read a while ago, and some code I read). If you say so you're probably right.
 
@BenjaminGruenbaum I'm not sure what you mean. Those are the reasons people use closures as building blocks.
lol
 
@LeviMorrison you think people use closures as building blocks because they're bad programmers?
 
@BenjaminGruenbaum no, no. They use closures as building blocks because they 1) have to in order to integrate with other things they need and 2) they don't understand the prototype so they never do things that way and instead just close over variables.
 
@LeviMorrison you think people use closures because they don't understand OOP o_0?
 
@BenjaminGruenbaum No, they don't understand the prototype.
 
2:15 PM
You think when someone like Misko Havery writes code with closures it's because he doesn't understand "the prototype" or OOP :D?
 
It's different from classes.
@BenjaminGruenbaum I already said I don't have experts :)
 
Or when Brendan Eich writes code with closures it's because he doesn't understand how prototypical inheritance works :D
lol.
 
In fact, most of the developers I network with don't have experts either.
 
No no, lots of people using JS write closures all the time because they make for readable code.
 
I still don't know what you are saying.
I said people use closures all the time in JS because they are the basic building block for everything and you just reinforced all of that.
 
2:16 PM
@LeviMorrison I'm not buying into the "people don't understand the prototype" as why people use closures.
@LeviMorrison no they're not and no I did not. They're very useful but they're not how people build everything.
I don't write closures in my own code very often because it's slower and I deal a lot with performance sensitive code where every cycle counts for io.js or otherwise - but they're a lot more useful than a lot of stuff.
Look at the Retry example - how'd you write it without a closure here?
 
I'm done with this conversation then. You don't agree with the premises and I'm not going to throw my years of experience out the door that tells me otherwise ;)
 
@LeviMorrison sure thing buddy, I'm sure you know how the JS community and ecosystem works way better than I do.
 
@BenjaminGruenbaum I'm saying that your community is not the same one I have seen.
 
Clearly you have a much deeper understanding of how people write JS code, you've done lots of cross-cutting research on it :D
@LeviMorrison right, because your average "JS developer" you meet is just a PHP developer who happens to have to do some JS. Most JS developers I know who do it full time, as well as what research of how JS is written on GH indicates that people aren't as shitty as you'd think.
I'm not talking JS room, I'm talking "average developer that has GH", that's still a lot higher than "any developer" but it's still a strong indication.
 
Most PHP developers I know don't have github either.
Of course the ones who have repositories are biased towards being better developers.
 
2:21 PM
Meh, even if we say the "average" JS developer doesn't understand what a prototype is at all and can't do any OOP, I still have no idea what that has to do with closures.
There are lots of use cases you can do with closures that'd otherwise require much more powerful tools like Macros, some languages (like Swift) even have a way to make closures look like normal language constructrs.
Most people don't understand functional programming well enough out of those who don't understand the prototype, so chances are that non-mutating closures cripple their ability a lot anyway.
I've seen the following at least 5 times when I looked at other people's code:
Retry(3).Do(() => {
    varFromClosure = SomeOpThatMightThrow(arg1FromClusre));
});
I've only seen the following once, and in my own code:
var value = Retry(3).Do(() => {
    return SomeOpThatMightThrow(arg1FromClusre));
});
 
2:40 PM
@BenjaminGruenbaum just read through the v8 post. interesting, but sadly not very relevant for php, on account of us not having a jit ^^
 
@NikiC there are efficient ways to implement closures afaik, I'd have to look for my compiler course notes. Sometimes they're just compiled to classes.
 
@BenjaminGruenbaum I would not consider our classes to be efficient :)
 
@LeviMorrison that's another issue
 
We've picked some low-hanging fruit at least.
 
I'm not sure why performance is that meaningful though, like 99% of all PHP code I've ever read didn't really care about CPU performance.
There's usually cache in front of it anyway and a lot of static-for-at-least-an-hour-pages. You just put Redis in front of it and worry very little about performance of stuff like closures.
 
2:42 PM
@BenjaminGruenbaum Generally it's not so much about the code being fast enough as it is scaling under load.
But yeah, performance is not necessarily an issue.
 
How slow can it be? You can just convert a closure to a struct and nested closures to an array of structs (or even a linked list).
You can lexically analyse it and do a fast path in like 90% of cases where there are no quirks like references or eval there.
But yeah, no JIT and no AOT means that performance of CPU intensive code isn't really a priority for PHP. It's OK, Python does just fine with native modules too.
You can outperform a language like Java with a JIT and a pretty smart AOT too with a language like Python by using something like NumPY that just calls really fast C++, C and Fortran internally.
 
@BenjaminGruenbaum Yeah, we can probably live with an inefficient general implementation if we optimize to by-val capture in the cases where it's enough
 
@NikiC I prefer the by-ref that way.
 
Having some experience with extensions in PHP and Python and I can say Python does a better job of making extension development easier.
 
tl;dr everything is worse in php
 
2:45 PM
@LeviMorrison that's something you can work on.
 
No need for full symtablr sharing
 
@BenjaminGruenbaum If only I had more time :)
 
Don't look at me, you're the ones writing in it and for it :D
 
I'm working on union, intersection and enumerated types and better traits.
 
I only use PHP at the backend when I use an existing code base like WordPress :D
 
2:47 PM
I'd love to find some company somewhere who values PHP enough to have full-time employees working on improving the language/ecosystem.
 
You mean like Facebook?
 
No, Facebook doesn't fit that description.
They decided making their own engine was better.
 
Now that's subjective. They are working on the spec etc.
 
@LeviMorrison (and it was)
 
To be fair in JS there are quite a few companies like that. Google, Microsoft, Apple, etc as well as companies like Rackspace, IBM etc have people doing that full time.
 
2:48 PM
@NikiC Depends on the goals.
HHVM is definitely more complicated.
 
@NikiC also... We could have partial symtable sharing and by-ref closing over... So that e.g variables assigned by ref are used via lexical fetch; and normal uses are using cvs...
 
That's okay, but in an engine driven almost entirely by volunteers complexity can hurt the contributor pool.
 
Definitely.
 
@LeviMorrison Yeah, gotta admit that reading hhvm code requires a stronger compiler background
 
I'd prefer if Zend always remains simpler than HHVM.
If Zend Engine adds a JIT or native code generation or something like that it loses one of its niceties.
 
2:50 PM
Then again, there are a lot of really bad things that can happen when a language is driven almost entirely by volunteers. Like someone implementing goto as a way to gain experience with the code base and it getting merged into the language :D
@LeviMorrison v8 is ugly at several places but I definitely think it's readable.
Why'd you want people without a compiler background working on a compiler anyway?
 
@LeviMorrison But on the other hand, HHVM might still be easier to understand than Zend code due to using a proper programming language :P
 
coursera.org/course/compilers - tada, a great entry barrier, anyone with mild understanding of CS can do that and learn a ton doing it.
 
@NikiC Teehee.
Honestly I'd love to write an engine that does an optimizing interpreter that uses graphs only.
 
@BenjaminGruenbaum somewhere one needs to gain experience... I had no compiler background before working on Zend
 
Heck, even make them do www.nand2tetris.org but if you don't know what a syntax tree is you should not push code to a compiler
 
2:52 PM
 
@BenjaminGruenbaum @bwoebi Oh, I don't count knowing what a syntax tree is as compiler background
 
@NikiC I don't either, that was an overstatement.
 
I like having Zend Engine and HHVM, honestly.
 
Multiple implementations are great, pinky swear.
 
2:54 PM
Especially when internally they are very different.
 
"Competition" is always good. Without HHVM, would the core devs have been so driven to find the performance boosts they have done for PHP7?
 
@BenjaminGruenbaum Also to clarify I wouldn't mind working at Facebook on the Hack or HHVM team.
 
Yes, definitely. Stealing ideas is awesome.
@LeviMorrison go do that then :)
 
I would prefer to work directly on Zend Engine (or a compatible replacement) and the spec, bugs, etc.
 
@NikiC Hmm. I'll at least try making the 99% fast. Tge one percent then can have a slower implementation. AST analysis ftw.
 
2:57 PM
OMG this is priceless bugs.php.net/bug.php?id=49594
9
 
@BenjaminGruenbaum Basically to work on Zend it's enough if you only know what a syntax tree is (and that's a very recent requirement ^^). You don't need to know anything about control or data flow analysis, you don't need to understand SSA, you don't need to know x86 assembly or llvm ir
 
@LeviMorrison go work on an engine for another language, I think it'll give you a lot more insight and you'll be able to contribute a lot more insight than working on PHP.
@NikiC I actually learned something insanely cool using DFA the other day - I proved an algorithm's complexity bound using it an expanders (basically graphs that behave well in terms of expanding when you take a group of node and then all their neighbours and so on)
 
@BenjaminGruenbaum Sure. I have to weigh the options though: improving the lives of PHP developers is a much bigger audience than improving the lives of wren developers.
 
@LeviMorrison improving the lives of JS developers is probably an even bigger one, just saying.
Wanna see the lecture I'm giving on Sunday btw ?
 
@BenjaminGruenbaum That sounds interesting, though I don't immediately see how DFA and complexity analysis go together
 
3:01 PM
@NikiC it's awesome. Lemme see if I can find it
 
@BenjaminGruenbaum What's it about?
 
If you don't have a strong math background (like, first year of college) it'll be hard but ok.
@NikiC really fast matrix multiplication given fault tolerance. Lemme find it too
 
@NikiC most people already fail with bison when they encounter their first reduce conflict
 
@BenjaminGruenbaum yes. Also first time I'm using office in a year I think
 
3:02 PM
Assuming it does - open it, basically you traverse the DFA and prove things about it (bound the number of messages sent, this is an algorithm for matrix multiplication in clusters).
@NikiC I didn't write it.
 
@BenjaminGruenbaum but looks like openoffice can't deal with the formatting at all
it looks very messed up
 
@bwoebi I understand what the shift/reduce conflicts are but solving the issues is not about knowing bison but understanding how grammars work.
 
Here's my presentation btw: docs.google.com/presentation/d/… Criticism and opinions highly appreciated
I have to go, convert it with an online tool or something (the DFA one), ttyl
Wife wants to kill me :D See you guys later.
 
@LeviMorrison Reading a grammar, yes. But writing one is harder...
 
@bwoebi Yep.
 
3:19 PM
@NikiC Something like that, though I am till drawn to the colons... ::() {} and &::() {}.....
 
good mornings
 
@Danack that was not serious
 
3:41 PM
Blah
 
@ircmaxell morning :-D
 
There's one very important point I think you miss with the reference argument. JS does not bind closed variables by reference.
The closed variable is the same variable. It's not two variables referencing each other, it is the same variable.
 
@ircmaxell We're aware
 
That's something you can't emulate with references and what we have today.
 
And the fact that it is the same variable is tricky to implement
 
3:50 PM
Yes it is
However, I do agree with @BenjaminGruenbaum in that if it's going to close scope, it should be by-variable, not by-value or by-reference...
 
@ircmaxell you can emulate by-variable to some degree by by-ref
And then manually add the by-variable for the cases where by-ref doesn't work
@ircmaxell Also, yes, I'm going to try that.
 
posted on May 02, 2015 by nikic

### Added * Errors can now store the attributes of the node/token where the error occurred. Previously only the start line was stored. * If file positions are enabled in the lexer, errors can now provide column information if it is available. ...

 
@bwoebi the "to some degree" is what I worry about...
 
@ircmaxell oh yeah, by-variable is a much better term for what I was thinking about.
@ircmaxell yes - that's a super important distinction actually.
 
well… I need to think about it…
In programming nothing is impossible… just maybe impossible to reduce to a low runtime…
 
4:05 PM
Ya.
By-value isn't the end of the world either, but I think I prefer no binding to it. But I could be persuaded
 
@NikiC Is it possible to make CVs IS_INDIRECT? That way we could point to the symbol table contents…
in short Closures
And as everyone ultimately is accessing the same pointer, we won't have recursion issues.
 
@bwoebi no
 
Why not?
 
because we'd have to check for indirect cvs on every access
 
4:19 PM
@NikiC we anyway have to check on every access for IS_REFERENCE
or not?
 
@bwoebi Not always and not always on the fast path
 
> file_get_contents(C:\Users\Gerrie\Desktop\ph\Websites\Minifine\test/Data/css/boo‌​strap.min.css): failed to open stream: No such file or directory
Goddamnit. Finding the error really took me waaay too long
 
Make a new type of CV? BoundVariable?
 
@ircmaxell A specialized VM mode?
 
Yup
 
4:23 PM
Thought about the same right now
 
I don't know what the costs of that are. @NikiC ?
 
Not saying its a great idea, just it should work with minimal performance hit to other code...
The engine will get much larger tho, which is a problem
 
@ircmaxell Tell that Derick who added 400 KB data with his tz db updates^^
But, yes. it'll add a few thousand LoC in vm_execute.h
...
head -45100 Zend/zend_vm_execute.h | grep '_HANDLER(ZEND_OPCODE_HANDLER_ARGS)' | grep '_CV_' | wc -l
     412
well, it'd be 412 new functions…
[Well, a little bit more because SPEC_CV_CV, but well]
 
4:41 PM
Yeah, but 400kb without cache critical performance. The engine is cache critical...
 
@hakre too much work for such simple thing :D
merged btw, and added you as collaborator
 
If possible since by-ref is slow and same-variable may be impractical is it possible to make it read-only and do it by value?
 
@Worf hehe, but those test-case is getting quite well :D + thanks for the collaboration status.
 
@LeviMorrison not really without impacting other critical areas again… at that point we just can make by-var…
@LeviMorrison and by-ref isn't slow.
 
4:44 PM
I tend to add some more reflection.
 
If we didn't have references we could make read-only doable in the compiler without too much work :/
 
I wonder whether two or three asm ops (fetch, compare, jump) or caching weighs more… @ircmaxell
 
(since it doesn't have to make it to byte-code, just compiler)
 
But anyway, need to go shopping quickly now or I won't get any good chicken for the weekend.
 
lol :D
 
4:46 PM
@bwoebi improving cache efficiency will be orders of magnitude more impact than. Reducing a branch or two
 
@ircmaxell that's what I thought.
 
Hello guys i want some suggestions

I have 3-4 years of experience in core php ( i know ci, laravel ), recently i am getting interested in the Linux (I am not a total newbie to linux i already know how to write simple shell scripts) and thinking about passing LPIC-1 certifications for better career options.

I am from India. Here you can hire a php developer on low wages, that's the reason behind my question. Is it better to learn Linux or stick to php ?
 
A branch reduction miss is about 12 clock cycles on modern hardware. A L2 cache hit is 10 clock cycles. A L3 hit is 40. A main memory read is 200-300 cycles...
 
branch reduction or branch prediction? Or is it the same?
 
If everything is in L1, branches dominate. If everything is in L2, its about even, and all else is cache by a long shot
 
4:50 PM
@Cody You can perfectly stick to PHP and learn Linux.
 
@bwoebi with pipelining a branch prediction hit costs the same as no branch
Well, almost
 
@ircmaxell So, an UNEXPECTED(...) should do fine?
 
It's tricky. Because expected/unexpected only determine code layout. The branch predictor in the CPU is uneffected by it... At least that's my understanding.
 
@hakre I don't know much about LPIC certs, do they really shine my cv
 
@Cody What does "core php" mean?
 
4:52 PM
@PeeHaa It's mean fully in php wihtout any framework involved
 
@ircmaxell Doesn't it determine code layout in a way so that branch predictor initially prefers expected branch?
 
I don't know
 
Ah k. Well as @hakre said. Why would one exclude the other?
 
I know it lays code so there is no jump in the expected case. But with pipelining, that may not effect the predictor. It may. I just don't know.
All I know about the branch predictor is that it is black magic...
 
and the variable fetch is anyway in L1 cache [or is loaded into L1 cache at that place to anyway be retrieved a few cycles later]
 
4:55 PM
True, but where is the next instruction's opcode? Increasing the engine size could push it off the cache lane...
It is worth experimenting with tho...
 
no, I mean in case we change _get_zval_ptr_cv_* functions etc.
we don't do any extra mem loading… only a branch
 
Ah. Yeah, I am not sure. Worth testing tho...
At that point tho the extra instructions may become a bottleneck tho...
 
@ircmaxell it's just a compare and a branch?
why should that be a bottleneck?
 
Not bottleneck, regression
Its a compare and branch for every variable interaction in the engine...
 
@ircmaxell how does one profile that? I expect that difference to be very minimal
 
4:58 PM
That's a lot of instructions to something like wp
Not sure, I know Dmitry and Pierre have done those types of profiles...
 
yeah, for about 30-40% of the opcodes then.
 

« first day (1659 days earlier)      last day (3304 days later) »