BloonPHP [PHP] [RSA, DH, RC4] [R63B]

Status
Not open for further replies.
Re: BloonPHP [PHP] [RSA, DH, RC4] [R64B]

Ah man, this would have been awesome! but in the end it will never be "stable". PHP is just a horrible language to write a server applications in. Use PHP for whats it is meant for, web applications.
 
socket_select($changed,$write,$except,NULL);
foreach($changed as $socket){
if($socket==$master){
}else{

Since it's only going to be the first in the array, I think it would be better to do

socket_select($changed,$write,$except,NULL);

if($changed[0] == $master){
master code
unset($changed[0]);
}

foreach($changed as $socket){
normal code

Otherwise you'd have a if/else 500 times (if you have 500 online users) that's not necessary
 

No, $changed array count is not always 1 :ehh:
 
I never said that, I said only the first item in the array has the potential to be the master, so checking on all of them (can be 500 if you have that many connections) would waste a lot of if/else checks

Another tip: If you're aiming for a high speed you should squeeze out every bit of performance you can and use as less overhead as possible. Use static so the pointer to the values doesn't have to be passed, pass strings and arrays as a pointer so they're not copied in memory, send buffers ASAP so you can reuse the memory and not get 1000 of buffers laying around. Also, you should find the best way to emulate "async" in PHP so you can send tasked packets to sockets that are still waiting for a potential send/receive. That was the part where I gave up because my implementation (async with suppressed socket async -> bool (false) means no data -> check for tasks). By that I mean for example a working pathfinder.

I hope your project goes well, if it does we might finally get a good working emulator across all OSes

PS: For is slightly faster than foreach NVM THIS
 
Last edited:
Well it isn't.


...and the list goes on

Did you pull that fact from your arse?

I read about that a lot on old websites, I guess it isn't true anymore or they didn't try it
 

Crowley.
Sierra.
Grizzly.

--
Also, you could look into HipHop if you want near-native performance from PHP.
 
I use PHP pthreads for multi-threading (just pathfinder for now) and I will use PHP APC for shared memory between all threads.
azaidi : I don't need emulate "async", I use real posix multithreading with pthreads
 
Status
Not open for further replies.