« first day (1867 days earlier)      last day (3067 days later) » 

10:00 PM
@NikiC no difference
 
@methhead You can drop the === true if ti works it will be truthy
Besides that your code looks fine to me
 
@Andrea Try -dopcache.optimization_level=-1
 
@NikiC no change
 
@Andrea can you link whole test code?
 
<?php

class Test implements ArrayAccess {
    public function offsetExists($offset) {
        echo "offsetExists given ";
        var_dump($offset);
    }

    public function offsetUnset($offset) {
        echo "offsetUnset given ";
        var_dump($offset);
    }

    public function offsetSet($offset, $value) {
        echo "offsetSet given ";
        var_dump($offset);
    }

    public function offsetGet($offset) {
        echo "offsetGet given ";
        var_dump($offset);
    }
}
That's the first part. I already pasted the second.
 
10:03 PM
ok let me try
 
I wonder if this is only triggered by const
 
@NikiC we could though not immediately push everything on stack, but make init opcodes put the information into a few temporaries instead… a few IS_PTR and the object can even be properly managed by liveliness… then we won't work on an EX(call), but on information being pointed to in some temps…
 
@Andrea $test[(string) "123"] works
 
hmm
 
@PeeHaa Ok i'll try that now
 
10:04 PM
Is opcache loaded?
 
and then just copy to stack when doing the actual fcall…
 
-dzend_extension=`pwd`/modules/opcache.so?
 
@NikiC Ah, it is now.
I tried two fixes but not simultaneously
 
When i drop the === TRUE my whole code stops running xD let me try get the error log
 
that is, (string) and -c`pwd`php.ini
using them together solves it :)
 
10:05 PM
@Andrea For context, cast is one thing compiler does not evaluate but opcache does
I always use it for testing
 
@NikiC yeah, I figured that was it
$ sapi/cli/php -c`pwd`/php.ini test.php
offsetExists given boop?boop?boop?boop?boop?boop?boop?boop?int(0)
offsetExists given int(123)
offsetUnset given int(0)
offsetUnset given int(123)
offsetSet given int(0)
offsetSet given int(123)
offsetGet given int(0)
offsetGet given int(123)
Now that's fascinating output. I added a debug print, printf("boop?")
Yet it shows up mid-execution of the code. :D
Not information I needed, the order doesn't matter, but that makes me curious as to why
 
hm?
 
@PeeHaa still getting no joy hm
 
I'm wondering why the debug print was triggered after printing "offsetExists given " but before any of the other code
 
where did you do the printf?
 
10:09 PM
    case ZEND_FETCH_LIST:
        if (Z_TYPE_P(val) == IS_STRING) {
            zend_ulong index;
            printf("boop?");
            if (ZEND_HANDLE_NUMERIC(Z_STR_P(val), index)) {
                zval_dtor(val);
                ZVAL_LONG(val, index);
            }
        }
        opline->op2.constant = zend_optimizer_add_literal(op_array, val);
        break;
 
@PeeHaa http://pastebin.com/DLZsnVC3

I've made this, should be a bit easier to read plus i've defined the sid variable
 
@Andrea Ah. Some kind of weird interaction with buffering?
 
sUP
holly shit, I haven't seen a mysqli_* function in more than 2 years :X
 
@NikiC I was wondering if it might be that, yeah
oh, might be separate buffers
wtf how do you make a .phpt that works with opcache
run-tests.php seems to override zend_extension so it can't possibly be loaded
uhhhhh
 
@Andrea You add it as a normal test
Without mentioning opcache
 
10:20 PM
@Andrea what's the problem? There's tests there for opcache....maybe enable opcache.enable_cli ?
 
People (and travis) will test it with opcache
 
@NikiC but run-tests.php won't use opcache to run it, will it?
Ah okay
hmm, I guess I need to pass a flag to force it to
 
You can of course also explicitly require opcache, but imho that's rather counterproductive
 
@NikiC I'm now having really big ideas… Well… we could put the function arg temps on the end of the temps and then use that as CVs… basically: old_cvs old_ex old_temps new_cvs new_ex new_temps … the old_temps and the new_cv part would then overlap… and we precede the function arg temps by a few temps containing fbc, flags called_scope and This…
then we have everything managed by temporaries and the liveness…
 
http://pastebin.com/DLZsnVC3
Could somebody help me with a problem I keep having. I'm trying to prepare an sql statement and bind a variable to it, then create a a while loop to loop through and display the results. I've included a pastebin. Any help would be appreciated. I've tried looking through the manual and even followed step by step and it's not working. I'm obviously going wrong somewhere i just dont know where xD
 
10:27 PM
@LeviMorrison remove the interface and method part and I am with you
 
basically, a nested fcall f($a, g($b), $c) would look like:
INIT_FCALL -> writes to temp 1 (fbc, flags) (called_scope and This would be temps 2 and 3)
SEND_VAR -> writes to temp 4 (1st arg, 1st call)
INIT_FCALL -> writes to temp 5 (fbc, flags)
SEND_VAR -> writes to temp 8 (1st arg, 2nd call)
DO_FCALL -> writes retval of 2nd call to temp 5 (2nd arg, 1st call)
SEND_VAR -> writes to temp 6 (3rd arg, 1st call)
DO_FCALL -> does 1st call
 
You have a bind var in your query that you haven't bound when you execute it
You need to bind the param before executing the query
 
@MarkBaker Ok i've switched the execute and bind param around and still not working
 
Yo, could some of you benchmark my bugfix?
I want to see if the perf gain I got is reproducible on other systems/configs.
 
In my IF i now have:
mysqli_stmt_bind_param($st, "s", $sid);
mysqli_stmt_bind_result($st, $ayr, $status, $ptitle, $lvl);
mysqli_stmt_execute($st);
In that order
@MarkBaker
 
10:34 PM
Why is opcache's optimiser still separate from the compiler, anyway?
 
bind the result after the execute
 
PHP has two optimisers in completely different places which work at different levels o.O
 
@Andrea gimme a mom
 
Alright
Sorry to bother you so much today.
 
@MarkBaker tried that and still no joy
 
10:42 PM
Then consider a little bit of diagnistics/error checking.... all of those mysqli_* calls will returna Boolean false if they fail, so check those statuses
 
I have no idea why its not working :(
 
@Andrea With your patch I'm seeing about 5% regression on doing a constant string lookup
 
Interesting
 
@NikiC does that affect actual arrays as well? Or just AA?
 
Arrays are what the code tests
(Though I don't know if NikiC is using the same test case)
 
10:44 PM
@Andrea what bugfix are we talking about now?
 
@Andrea My results are currently rather unstable, I think 5% was an overestimation
Someone on native hardware should test it
 
Ah
My test case should really run for another order of magnitude iterations
That makes the benchmarking a pain, though :p
 
If any of those statement calls returns a false, you can display use mysqli_errno() and mysqli_error() to get the details
 
But I'm pretty certain I see a slowdown, not a speedup ;)
 
10:46 PM
Yeah
Are you using GCC?
 
yes
 
@NikiC are you sure you can't throw an exception there (the hashdos)? after all, this condition never will be met in most code under no circumstances… only ever where arrays passed in by user are modified… which pretty much restricts the scope of involved places…
 
I wonder if GCC is optimising it differently. Hmm
I'll compile with GCC then!
 
@Andrea Just going by logic you must be seeing a fluke ...
 
I'll try it again
 
10:48 PM
You may see effects due to different code layout, but if so that's just chance
 
Notably this only appeared on non-debug builds
Debug builds saw a regression
 
hello guys, i have few questions, the first is pretty silly
http://pastebin.com/dHTVQYHK
you can insert in description a string, but will output only 1 word from mysql row, why? should I loop it or is there something else? pretty basic i know, perhaps i should make the field bigger?
 
brb closing firefox to avoid prejudicing my next test too much
 
Regardless of the ~5% regression, shouldn't fixing a bug take precedence anyway? That defines the behaviour of the major version, breaking BC, which can then be optimized in .0.x etc.
 
@rtheunissen There is no way this is landing into PHP 7.0.0
 
10:51 PM
@NikiC :'(
I'm curious as to what the reasoning behind that is.
 
@rtheunissen Because we are currently at RC8 and this is a bug that has existed since PHP 5.4
There are few bugs that are less critical than this one
If this issue had been introduced by PHP 7, that would be a different matter. But this being an old, old issue...
 
What if there's an RC9 for a completely unrelated reason? :p
 
Doesn't change anything
 
"If this issue had been introduced by PHP 7, that would be a different matter."

Yeah I get that. I wish I came across it earlier.
 
RCs are cherry-picked
 
10:58 PM
Ah, I assumed they'd just be master tags.
 
@bwoebi I'm missing Aerys from techempower.com/benchmarks ^^
I guess the first step would be testing PHP 7 though
 
The margins suggest a fluke and yet always comes out slightly faster
 
Hi all, still having trouble trying to bind param to my sql query and print results into HTML table in while loop
Could someone PLEAASE help, i have this assignment due in tomorrow morning, i'm in a bit of a pickle
http://pastebin.com/DLZsnVC3
 
You haven't even changed that pastebin with the different order of statements that I told you to use earlier
Have you checked the return value of your statement calls? Have any of them returned a Boolean fasle?
 
Oh sorry, I have multiple versions open
Yeah nothing came back false
I'm not even concered about preparing the statements now, I just want to be able to run the query and loop by binding my sid variable
Also tried following the
http://php.net/manual/en/mysqli-stmt.bind-param.php
but it didnt seem too help me in my case
 
11:07 PM
Have you checked mysqli_num_rows() to see if you're getting any records returned?
 
shall i print it or ->error ?
 
mysqli_stmt_execute($st); and mysqli_stmt_bind_param($st, "s", $sid); are still the wrong way round
 
@NikiC :-D
 
I have put the bind_param outside the IF statement, then have:
stmt_execute...
stmt_bind_results
Inside the IF statement
ill make an updated paste bin
 
@NikiC no matter how many times I run it, fixed is faster. So I'll try GCC
 
11:10 PM
I've checked to make sure my actual SQL query is correct and it works fine. Just cant get it to actually paste onto my .php page xD
Any ideas @MarkBaker
Anyone?
 
prepare, then bind params, then execute, then bind result
 
All inside the IF?
That is the order I have it in
I think the problem may lie in the conditions with my while loop?
while (mysqli_stmt_fetch($st)) {
 
In what you've just pastebinned, the mysqli_stmt_bind_param($st, "s", $sid); is before the if
 
11:25 PM
Let me show you my updated sorry.
I can't see what could cause the problem looking at my code now
 
Have you checked mysqli_num_rows() to see if you're getting any records returned?
 
how do i check that sorry
 
checked it
im getting 000
 
In that case, your query isn't returning any results
 
11:30 PM
Ooh. clang is about 33% slower than GCC :o
 
I've used phpmyadmin to check the query, the only thing i changed was from sid=?
to
sid= '166410'
so it must be an error during the binding or the $sid variable
 
Double-check that you have the records on your database that match the enrl.sid value that you're binding
Double-check that you've connected to the correct database
 
Yeh just double checked and it is returning, and yes connected to the right db
When i checked, like i said, the only thing i changed was sid from sid=? to an actual value and the return is correct
Could there be another cause to the problem
Even if i just edit my actual php code and change the sid from sid=? to sid = '166410'

Then that works.

So it must be something to do with the binding
 
Well are you binding as it describes in the documentation?
 
Yes :) check with my pastebin
 
11:40 PM
@Andrea maybe it's also just really bad luck with alignment and it goes to refetch often from L2…
 
Maybe
 
@bwoebi I've had things similar to that happen in the past
 
Ooh okay, this is interesting. For GCC, the fixed version is very slightly faster, the fixed + newly optimised version is more significantly faster
whereas in clang, my optimisation makes it slower
 
Where some seemingly innocuous change results in slightly different code layout and that resulting in out of proportion performance changes
 
It's rather surprising for sure
 
11:44 PM
@Andrea Or maybe something just doesn't get inlined which we assume to be inlined
If the op_type check is in a helper function, that is
 
Or some other change
 
@Andrea sometimes it's also good to just look at instruction count…
 
nighty
 
especially in cases like these, they should be tie-breaker…
 
SQL injections aside.... instead of using prepared statements and binding.
Could i just put into my query something like stud.sid = " .$_GET['studentID'] . "
Question for anyone;
 
11:48 PM
@NikiC night
 
@Andrea are you able to answer my question please
 
@Andrea so, what's call-/valgrind saying for the three different versions? (old, new, new optimized)? (also maybe compare gcc and clang…)
 
@methhead you should definitely not be doing that, as studentID could be anything.
Prepared statements is 100% the way to go.
 
@bwoebi what would valgrind do here? tell me instruction count?
 
yeah
 
11:51 PM
@rtheunissen It's only for an assignment which is due in a couple of hours and security isn't a problem so i just need a way of getting that variable in there. My studentID is being entered by the user via a text field
 
@Andrea and tell you what's probably fastest, on average on compilers…
 
Just wondered if i used stud.sid = " . $_GET['studentID'] . "
should that work
 
Aside from the $st->free(); which should give you a fatal error, that code works
You're using procedural everywhere else, $st->free() is the OOP method
I've created a database and populated it, copy/pasted your code, fixed that one line, and run it.... it returns a record and displays it in the table
 

« first day (1867 days earlier)      last day (3067 days later) »