Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
abraham linksys
Sep 6, 2010

:darksouls:
if you know how to bold text on this forum then you're basically 50% of the way to knowing html

Adbot
ADBOT LOVES YOU

Nomnom Cookie
Aug 30, 2009



Tiny Bug Child posted:

that said i have never once come across a legitimate use for eval in php

you've never used create_function?

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

Nomnom Cookie posted:

you've never used create_function?

no. that's old hacky php 4 poo poo, php has real closures now and has for a while

jooky
Jan 15, 2003

this av change is really sealing the deal that tbc is just a shaggar alt account for me

Notorious b.s.d.
Jan 25, 2003

by Reene

Tiny Bug Child posted:

that is definitely a Weird Edge Case tho. one global db conn is best for most applications

yeah this except the opposite


it explains a lot about your lifestyle if your apps can survive on a single shared db connection

MononcQc
May 29, 2007

Didn't PHP have a connection pool of some sort that the mysql driver interfaces used as a disguise, or is it just doing the silly thing of one native process per request and each one of them setting up its own connection?

E: it's optional and barely used I guess. It used to be mysql_pconnect(), then it got deprecated for either mysqli_connect with a p: host prefix, or PDO with PDO::ATTR_PERSISTENT as a driver option when constructing it. These get the mysql drivers to set up 'persistent connections' and to reuse them when possible. Not sure it's any form of adequate pooling though.

MononcQc fucked around with this message at 17:02 on Sep 18, 2013

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

Notorious b.s.d. posted:

yeah this except the opposite


it explains a lot about your lifestyle if your apps can survive on a single shared db connection

i don't know what kind of weird rear end environment you think is normal but "script starts a database connection, does db poo poo, ends, php closes connection" is how 99% of php scripts work

uG
Apr 23, 2003

by Ralp
how 99% of php scripts work should be an ad hominem

MononcQc
May 29, 2007

Tiny Bug Child posted:

i don't know what kind of weird rear end environment you think is normal but "script starts a database connection, does db poo poo, ends, php closes connection" is how 99% of php scripts work

when you know 99% of your scripts/pages use a connection to the same DB, it's nicer to have a connection pool pre-warmed so that you do not need to have the overhead of negotiating a connection for every single concurrent page for every request. The pool will instead have the thing ready to serve directly and you'll gain in performance.

Then again, most PHP applications have their bottleneck for the user in something like serving static assets over a limited number of domains/subdomains, or just not having a very well designed DB structure so the requests themselves are slow there.

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

MononcQc posted:

E: it's optional and barely used I guess. It used to be mysql_pconnect(), then it got deprecated for either mysqli_connect with a p: host prefix, or PDO with PDO::ATTR_PERSISTENT as a driver option when constructing it. These get the mysql drivers to set up 'persistent connections' and to reuse them when possible. Not sure it's any form of adequate pooling though.

persistent connections are unnecessary, break things, and are definitely not commonly used in php

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
we have a script that about 12 million uniques pass through a day that opens up two separate fresh db connections and it runs just peachy

power botton
Nov 2, 2011

Because php can't implement connection pooling properly, just redefine what "best practice" is.

MononcQc
May 29, 2007

That's because the PHP drivers for MySQL poo poo are terrible.

Shaggar
Apr 26, 2006
well of course. they're mysql drivers and they're for php.

MononcQc
May 29, 2007

I should have expected as much.

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

MononcQc posted:

Didn't PHP have a connection pool of some sort that the mysql driver interfaces used as a disguise, or is it just doing the silly thing of one native process per request and each one of them setting up its own connection?

E: it's optional and barely used I guess. It used to be mysql_pconnect(), then it got deprecated for either mysqli_connect with a p: host prefix, or PDO with PDO::ATTR_PERSISTENT as a driver option when constructing it. These get the mysql drivers to set up 'persistent connections' and to reuse them when possible. Not sure it's any form of adequate pooling though.

it's really bad

back when i used php and r1 hosting was a thing r1ch im'd me to tell me to not use the pool because it was broken and leaking connections

no fuckin' idea

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Shaggar posted:

well of course. they're mysql drivers and they're for php.

they're not "for" php so much as they're an integral compiled-in part of php

Zlodo
Nov 25, 2006

lol

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Tiny Bug Child posted:

i don't know what kind of weird rear end environment you think is normal but "script starts a database connection, does db poo poo, ends, php closes connection" is how 99% of php scripts work

If you got a huge swarm of users all at the same time, wouldn't you start hitting connection limits from the database?

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

Hard NOP Life posted:

If you got a huge swarm of users all at the same time, wouldn't you start hitting connection limits from the database?

it turns out that the connection limit is a configurable number that you can make really high

Breakfast All Day
Oct 21, 2004

Tiny Bug Child posted:

it turns out that the connection limit is a configurable number that you can make really high

yeah i just set it to +Inf owned people who know poo poo about databases

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
i'm not saying we didn't have to throw some pretty serious hardware at the problem, because we did, but you can't put a price on being able to write in the best language

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
in all seriousness though i'm actually in the middle of redoing that one script so it doesn't open db connections at all and just passes messages to always-running processes that keep a connection permanently open. and when that's done i'll look like a genius for reducing our db usage by like a bazillion. who's the smart guy now yospos

MononcQc
May 29, 2007

next step is to have more than one of these processes and pick any that is free. then you have actually implemented a pool.

Shaggar
Apr 26, 2006
the process should have a pool behind it which would be good enough until you need more capacity

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Tiny Bug Child posted:

in all seriousness though i'm actually in the middle of redoing that one script so it doesn't open db connections at all and just passes messages to always-running processes that keep a connection permanently open. and when that's done i'll look like a genius for reducing our db usage by like a bazillion. who's the smart guy now yospos

not you

Notorious b.s.d.
Jan 25, 2003

by Reene

Tiny Bug Child posted:

i don't know what kind of weird rear end environment you think is normal but "script starts a database connection, does db poo poo, ends, php closes connection" is how 99% of php scripts work

i wrote my last line of php in june 2011. i remember it like a quit date. if i had it my way, i would hand out tokens to my php support group like they do at AA


if i ever encounter another php codebase that i gotta work on, i'm either moving it to resin/quercus or pushing it through the scala migration helper. in either case i would have a modern app server and connection pool and db driver and never have to deal with bullshit again

Notorious b.s.d.
Jan 25, 2003

by Reene

Tiny Bug Child posted:

in all seriousness though i'm actually in the middle of redoing that one script so it doesn't open db connections at all and just passes messages to always-running processes that keep a connection permanently open. and when that's done i'll look like a genius for reducing our db usage by like a bazillion. who's the smart guy now yospos

the dude who just argued that connection pooling is unnecessary because php sucks at it....is making his own jerry rigged connection pool out of chicken poo poo and baling wire

this can only end well

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
tbc owns

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...

Notorious b.s.d. posted:

the dude who just argued that connection pooling is unnecessary because php sucks at it....is making his own jerry rigged connection pool out of chicken poo poo and baling wire

this can only end well

i mean, you're assuming that php's connection pooling is better than chicken poo poo and baling wire

Notorious b.s.d.
Jan 25, 2003

by Reene

Dessert Rose posted:

i mean, you're assuming that php's connection pooling is better than chicken poo poo and baling wire

no i am definitely not assuming that

in php, it's chicken poo poo all the way down

till you hit turtles

then poo poo gets uncomfortable

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Tiny Bug Child posted:

i'm not saying we didn't have to throw some pretty serious hardware at the problem, because we did, but you can't put a price on being able to write in the best language

Ah, that clears it up thanks

PleasingFungus
Oct 10, 2012
idiot asshole bitch who should fuck off

Tiny Bug Child posted:

it's like saying code doesn't count as pro python unless it has stupid interpreter-enforced formatting.

this is true, though

Tiny Bug Child posted:

i'm not saying we didn't have to throw some pretty serious hardware at the problem, because we did, but you can't put a price on being able to write in the best language

beautiful

PleasingFungus
Oct 10, 2012
idiot asshole bitch who should fuck off
so I'm starting to read up on pig.

is it just me, or was the design statement of pig 'we want the hideous syntax of SQL, but without all that boring, helpful abstraction'?

Condiv
May 7, 2008

Sorry to undo the effort of paying a domestic abuser $10 to own this poster, but I am going to lose my dang mind if I keep seeing multiple posters who appear to be Baloogan.

With love,
a mod


I'm subscribed to the jdk8 dev mailing list, and this unbelievably stupid email about optional was just posted by one of the devs...

quote:

There is a good reason to not allow Optional to implement Serializable,
it promotes a bad way to use Optional, at least from the VM point of view.

For the VM, Optional is a boxing, very similar to a boxing to Integer
(in fact it's a little better because Integer.valueOf is badly* specified in the JLS
but that's another story).

so if you write:
class Foo {
private Optional<String> description;

public Optional<String> getDescription() {
return description;
}
}

This implementation id bad for two reasons, the first one is that you have to do
a double indirection so will double your chance to have a value that is not
in the cache but in RAM when you want the underlying String.
The second reason is that the VM will usually not be able to remove the
boxing because the creation of Optional will be too far from the use.

There is a better implementation
class Foo {
private String description; // warning nullable !

public Optional<String> getDescription() {
return Optional.fromNullable(description);
}
}

It's the same API from the user point of view, but the creation of Optional
is in the same inline horizon that it's use if getDescription is inlined
(and here given that the method is really small, the is a good chance).
In that case the VM is able to remove the boxing and everybody is happy.

So making Optional serializable goes in the wrong direction.

Basically, lets cripple optional types because people might use them.

Zlodo
Nov 25, 2006
more like cripple optional types because our language sucks and have to store everything as a pointer to a thing allocated separately on the heap but now for some reason we actually do care about cache efficiency

jdk8 more like jok8

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Notorious b.s.d. posted:

if i ever encounter another php codebase that i gotta work on, i'm either moving it to resin/quercus or pushing it through the scala migration helper. in either case i would have a modern app server and connection pool and db driver and never have to deal with bullshit again

you're bug-chasing

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

PleasingFungus posted:

this is true, though

yes, exactly. my point was that autoloading is just how you do it in PHP. he was drawing a parallel between autoloading and eval like autoloading was as gross as using eval, but they aren't comparable at all

Zlodo
Nov 25, 2006

Tiny Bug Child posted:

yes, exactly. my point was that autoloading is just how you do it in PHP. he was drawing a parallel between autoloading and eval like autoloading was as gross as using eval, but they aren't comparable at all

the various shades of gross in PHP are hard to discern for normal people

Zlodo fucked around with this message at 19:41 on Sep 18, 2013

Adbot
ADBOT LOVES YOU

Breakfast All Day
Oct 21, 2004

has anyone tried julia yet? considering doing my next batch of research in it since I could contribute a few libs

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply