« first day (1436 days earlier)      last day (3512 days later) » 

7:24 PM
I'm on a roll
I finally improved division precision
Previously, if dividing two bigints, it would convert them both to doubles then divide them (if they don't divide exactly), but that means less precision and in some cases, a large bigint might be "INFINITY" as a float.
Now, I just make it use gmp's Rational functions to do a more precise division, then convert that to a double.
:D
$ sapi/cli/php -r '$a = 2138979379287301280391280398120382083012983012983091820398120938201983012830921830982309128038012938012830218302918038210380128122849802384029384092804824098028408230492084029840238402830480392840398409238048230840238409238409238409823094802384928402948029384023840982304982309482039840923840928340923840923098402934840298240942094840239823098423093248402982037250927850976237324094732; $b = 34923840923804832049803294032832498234982048039840923840982309480239840239840928409823094832094802938049823; var_dump((double)$a / (double)$b, $a / $b);'
 
^ it's.. great. But you may treat 10^277 as infinity as well. Since count of atoms in known Universe part is poor ~10^79..10^81
 
and now update intdiv for bigints :-)
@AlmaDo I need to calculate storage size for saving the state of the universe for each Planck time unit since its existence.
 
7:43 PM
hell, I just need to calculate it for 2
 
3/2=1.5float, 3%2=1, 3-1=2, 2/2=1(int)
 
@bwoebi it's impossible. Since no one knows for sure "when" the Universe was "started" and did that moment really happen
 
@AlmaDo multiply that by ~5.25 to include dark matter too
 
hi guys, i ask here as i think you'll know how to solve this. I've been having issues with my database, my connections just keep staying open. I've installed pt-kill which should kill processes matching certain criteria. The thing is, when i run it, it prints the pricesses it's killed. But if i then run show processlist the nu,mber of open connections remains the same. This is also the case when i try and kill processes manually.
 
8:00 PM
@AndreaFaulds isn't that adding a lot of overhead?
 
8:14 PM
physics is not a form of magical incantation, people
so, just because you do not understand most of it, it's not good enough reason to treat it as such
also , nn
 
indeed @tereško good point
 
I hope windows guys can work it out ...
we could have thread safety by default where supported, maybe pthreads in core ...
 
@Andy Something is going weirdly wrong if your connections are staying open and not being re-useable. Are you on windows?
 
8:29 PM
nope debian
 
@Andy Are your processes actually still running or do you think the PHP script has exited?
 
hmmm, the mysql connections seem to stay open so maybe the script has them locked somehow? is that what you mean? I am getting much more traffic now and trying to memcache the main culprits that cause a lock and stall, but doesnt seem to help
FML atm :)
 
github.com/kazuho/h2o interesting, "outperforms nginx by 2x"
 
it's mainly my advertising so i can reduce the traffic, which i have done and it's made a huge difference
 
@CSᵠ Probably.
 
8:39 PM
so i've got a bottleneck somewhere, from what i can gather
 
The naïve approach is almost certainly faster
 
8:50 PM
@AlmaDo just going to simulate current hypothesis :-P
 
@JoeWatkins Easy if you drop support for insane clients. Useless in the real world
 
@JoeWatkins Could make a faster one quite easily tbh. Have each resource available on a different port, and start sending before you get the request.
 
^ again, useless in the real world :-P
 
@AndreaFaulds how is the bigint division implemented currently?
 
Who cares, we just want to be king of numbers
 
8:55 PM
@CSᵠ with integer division + remainder division
 
Write it in assembler, win All The Things
 
@Andy What's probably happening is that your database is being overwhelmed. What happens is that too many requests try to make sql queries at once, more than the DB can carry out. What happens next is that the queries start backing up and fighting each other for SQL processing time - so that they get even slower.
 
@DaveRandom In theory, yeah
 
@DaveRandom why useless ?
 
@bwoebi just lol
 
8:56 PM
@Andy I'd recommend logging what queries take the most time (when your DB isn't locked up) and try to make them faster by either re-writing them to be faster, adding indexes or adding caching.
 
@JoeWatkins because dynamic requests? Or do you just deliver static content?
@CSᵠ no, really.
 
urm ... can be built as shared library ...
 
@JoeWatkins Because who wants a web server that doesn't support half of the internet because it doesn't have work-arounds for all the insane things they do (old IE etc)?
 
There's a good chance that if you can make a couple of slow queries faster, you'll make your DB fast enough to serve the requests, and so they won't start backing up and fighting with each other.
 
@DaveRandom not sure how you come to the conclusion it doesn't support half of the internet ... I see a decent api to create embedded servers, if there are oddities in such things as old browsers then not much to do with the features of the library ...
 
8:59 PM
@bwoebi well.. that would mean the bigint is limited to max_int so... still lol
 
haven't looked further than that, but it's not ruddy bad ...
 
@CSᵠ no, I mean with integer division that first a gmp division without remainder is performed and then the remainder added to it later.
 
I have a half working nginx module somewhere ... never bothered to finish it because the apis you are given are an actual nightmare ... this is nice though, I like it ...
 
I'd just be extremely surprised if it's both high-perf and feature rich, in the way that people want a modern web server to be. I've written extremely high perf web servers, and I've seen that perf disappear when you start trying to make it actually useful for stuff
@JoeWatkins can't argue with that
 
@bwoebi i'm probably missing something but IIRC gmpdiv does very well with huge numbers
 
9:02 PM
well it's obviously not feature rich, but a decent library it is ...
 
@CSᵠ just that gmpdiv returns an integer, not a double.
so, we use gmpdiv and then add a division on the remainder.
 
you can't argue with "2x faster than nginx" either ...
 
@JoeWatkins Beautiful in theory, useless in practice is still... useless. That's the thing people take away from it.
 
useless to everyone else, maybe ...
 
Don't get me wrong, I'm all for projects like this, but "outperforms nginx by 2x" is not a good reason to use it
 
9:05 PM
it is to me ... you don't get segfaults from fpm at random intervals ?
 
unless it does that, while providing the same feature set
 
@bwoebi ok, so where does it fail actually?
 
every project I ever worked on of a certain size does ...
 
@CSᵠ hmh?
 
@JoeWatkins Yeh but that's because fpm sucks, and it's not the fault of nginx, and neither is it a problem that this would solve...
 
9:06 PM
@bwoebi like in @AndreaFaulds's example
 
@DaveRandom nginx default feature set has grown... uncomfortably over the past few years
 
var_dump((double)$a / (double)$b, $a / $b);'
float(INF)
float(6.124696833759E+277)
 
I do wonder how much that impedes it as a simple content flinger
 
features++; performance--; standard procedure
3
 
@CSᵠ It's currently implemented like so:
 
9:07 PM
of course, just wondering about how much
 
1) both bigints are converted to gmp rationals, 2) the gmp rationals are divided, 3) the rational is converted to a double
 
@CSᵠ yes, in that case it's gmpdiv casted to a float (as the result isn't an integer). I agree that this one is suboptimal.
 
previously it worked like this:
 
Indeed. I'm certainly not going to claim nginx is perfect, I'm just wary of performance claims
 
1) both bigints are converted to doubles, 2) the doubles are divided
I have no idea what ext/gmp does
 
9:09 PM
I'm wary of performance claims that give a naked "requests per second"
 
@DaveRandom it is not the fault of nginx, sure ... a month or so ago I was tasked with creating a new sapi, I have looked far and wide for options ... nginx for better or worse is our best option, so I set out to write an integrated module that could better use manipulate nginx internals to provide stable platform to deploy php, hopefully eliminating the need for shed load of processes ... or so I thought, there are no internals that are useful, every single api absolutely sucks ...
 
@AndreaFaulds it doesn't care about floating point, it works with ints exclusively
 
@Leigh Yeah, I know
Speaking of which, I should update intdiv
 
div is mpz_div_q or something
 
@JoeWatkins I haven't looked at it, but I can believe it. "A much cleaner API" is a good reason. I'm just saying that spurious perf claims are not.
 
9:10 PM
I was gonna rewrite ext/gmp
but I actually don't want to
 
@DaveRandom I'm letting pass the brief language used ... I think Chinese/Japanese, other issue threads are not in english at all ... so maybe that's the reason ...
 
@JoeWatkins Japanese :)
 
yeah, that ...
 
@bwoebi in that case it's not the gmpdiv casted is the gmpinstance the one who's casted, then regular float division
@AndreaFaulds i might want to
omg, what did i just say?
 
I mean, for compatibility's sake
It may be best to leave ext/gmp as it is
It may also be faster than native bigints
 
9:17 PM
@AndreaFaulds test, test, test
 
If you break GMP, there's a lot of my code you need to fix ;)
 
Or maybe it's slower, I haven't tested and can't test yet
@Leigh Yeah
 
@Danack that's exactly what' happening. i am currently doing that very thing too, ref: slow query log etc... hence the use of memcache. I think i have other issues :)
 
Can't remember if I asked this or not, how do pack/unpack cope with bigints?
 
@Leigh Haven't yet touched that
I can't see them having a problem with bigints though
 
9:20 PM
well there's expected behaviour
due to the nature of PHP ints being signed
if that changes, things may break
 
@JoeWatkins I agree it looks promising, and looks like it's written by someone who knows what they are doing, I'm just a little suspicious of anything like that, it kind of mongo syndrome I guess (hey! we have awesome performance! of course, we don't actually write any data to disk, and if you pull the plug you're fucked, but look how fast it is!)
 
but it's web scale!
 
@FlorianMargaine yeh I know, it's on my list, as is another of my PRs, but last time I merged something it took like 2 hours
@derp lol I forgot about that
 
If I want to read a long file on server and parse it, and add it to the current HTML DOM nodes, should I use JS or PHP or both ?
I use :
 
9:35 PM
@derp that's fuckin funny
 
tobeparsed = "<?php echo file_get_contents('thefile.txt'); ?>";
var XMLS = new XMLSerializer();
document.body.insertAdjacentHTML('afterbegin', tobeparsed);
But then when i load the page, the source code of the page contains a veryyyyyyy long string "tobeparsed" which is visible in the source code...
So this is not the good way for doing it, right ?
 
@Andy It sounds like a single issue - if your DB is being overwhelmed just concentrate on that.
 
also funny
 
Is it normal that XMLSerializer serialises into : class=\"texte\" instead of class="texte"... ? Then when I want to read it again, the \ are a pain : the HTML page doesn't like those \ !
 
9:53 PM
What the hell is XMLSerializer?
 
javascript
 
I don't get it wtf that code is supposed to do, The XMLSerializer isn't used for anything, and the name suggests it would be for stringifying a set of nodes, not parsing a string. Also the code appears to be just inserting some HTML into the doc, so why not just output it in the right place?
 
@derp @DaveRandom here is the general thing I want to do :
1) a DOM node (and its children nodes) => stored into server file
During another session :
2) open server file => insert it into DOM again

I summed up in this question http://stackoverflow.com/questions/25964322/serialize-dom-elements-into-server-file-and-read-them-back
maybe you have an idea for that ?
 
hey :)
Im looking for some interesting coding /php related video before going to sleep :) someone a good talk/presentation ... to share ? :)
 
@Basj Oh I see... it sounds like your server might have magic quotes turned on?
 
10:05 PM
@DaveRandom magic quotes ?
 
@DaveRandom So I have 2 questions : the "quotes" problem +
 
Basically, it's something that would auto-escape your " to \"
you don't want it
(nobody wants it)
 
+ a more general problem : is it the right for doing this : serilization of DOM nodes + restore XML file into DOM again...
Is the general pattern that I use good ?
 
@Duikboot: saw google's clean code talks already?
 
10:06 PM
yep :)
 
@Basj Well, it depends exactly what the content is. If it's a form with a known layout (i.e. you want some specific data and you know where in the DOM it is) then you should just store that data - the current trend dictates that you'd probably use JSON to send it to the server, and there's nothing wrong with that. On the other hand, if the DOM nodes themselves are the data, then there's nothing wrong with your general approach
 
@DaveRandom yes the DOM nodes themselves are the data ! thanks for your advice
@DaveRandom I cannot disable magic quotes : don't have access to php.ini (shared hosting) and php_flag magic_quotes_gpc Off not accepted by my htaccess
 
blindly including in your site anything sent to your server is not a good idea
 
@derp can you explain ?
 
10:11 PM
@Wrikken found something: youtube.com/user/phpukconference
 
Aight, nice collection. I was going through my bookmarks, but they were almost all database or infrastructure related... I miss coding :(
 
@Basj You need a new host then, because magic quotes will screw you up all over the place. As a work around for this specific issue, you can base64 encode the data before you send it to the server (on the first page) and base64 decode it before you store it to disk.
But yeh, @derp is right, there are potentially some pretty hefty security issues here
/me is out for a bit, bbiab
 
@DaveRandom can you explain ?
 
11:09 PM
Argh
 
@JoeWatkins Already documented a tiny fourth or fifth of the xml. This work sucks. I hope I can do that quickly…
 

« first day (1436 days earlier)      last day (3512 days later) »