« first day (1750 days earlier)      last day (3198 days later) » 

11:00 AM
Hmm. You couldn't do the tagged pointer optimisation in PHP without abstracting zend_string raw character access. PHP expects zstr->val to always work.
 
@Andrea Why optimize strings though? They live for all of a few milliseconds. Nobody cares if you use an extra few pointers for a few milliseconds. Memory is cheap.
...relatively speaking
 
Oh sure
 
Optimizing the behemoth that was PHP Array, made perfect sense, on the other hand
 
If any gain could be had, it would be performance
 
@PeeHaa how are you man
 
11:05 AM
!!hi
 
@user3783598 hi
 
@Andrea The performance problem isn't typically with constants though. The biggest performance issues I often profile in the field have more to do with copying (i.e. lots of string concatenation/manipulation going on).
Not saying it's not worth optimizing, just that that would likely be a bigger win to focus on.
 
@Sherif this would help manipulation: string indexing, for example
 
We copy strings waaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaay too much in PHP
 
Yep
 
11:09 AM
@Andrea Oh yea, I am sure there are residual benefits there.
 
@Sherif PHP 7 helps a bit with this
 
A bit
 
Abe
morning
 
Not nearly as much as the change with arrays though
 
@NeelIon Pretty good. You?
@Abe o/
 
Abe
11:10 AM
\o hey
 
Which is what forced me to work an actual btree implementation that outperforms PHP Array :)
 
morning
 
Anonymous
moring
 
Given that my userland implementation is now literally 6 times slower on PHP 7 than PHP Array
 
Abe
@Sherif that's so annoying
 
11:12 AM
What is? PHP Arrays?
 
Abe
i tried implementing an avltree and yeah, it's slower than php arrays
 
Well of course, you have the overhead of context switching.
Whereas a PHP array is just a simple O(1) hash.
The userland implementation will never be as fast as it should be until it's implemented natively.
 
Abe
i wish i know c to implement it natively :P
or even c++ :P
 
constant amortized time vs. copying an entire hashtable, switching context internally within the engine, and not to mention possible fcall overhead
especially if you're implementation uses recursion instead of iterative
Plus insertion time of a btree from within the runtime is abhorrent. It makes no sense unless you can serialize the structure.
 
@Sherif well, the recursion is a tiny bit slower in C level too?
 
11:17 AM
Most overhead will probably be all those fcalls.
 
@bwoebi Right, it's slower everywhere
Just don't use recursion
Iterative will always be faster since it can be optimized down to simple pointer arithmetic :)
Well, OK, perhaps not pointer arithmetic, but pointer pointer arithmetic :p
 
@PeeHaa im fine
 
@bwoebi heh, I never looked at the phpdbg code
Good to know I can steal some of that code though :)
 
yeah, no problem ^^
 
11:20 AM
@tereško I studied about types. I think I should use of TIMESTAMP or DATETIME for storing both date and time, Now which one ?
 
But my implementation has way worse problems than just performance right now ... heh
 
I usually go with TIMESTAMP
 
For one, I realized how much of a bad idea it is to actually store an object for each node in the tree in PHP
:p
Store data value, return newly allocated object only upon access, then optimize with a cache table only when it's needed in the runtime ... win
 
the rage of `TIMESTAMP` is not limited ?
DATETIME: '1000-01-01 00:00:00' to '9999-12-31 23:59:59'
TIMESTAMP: '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC
 
@Sherif correct. Even in C… hence I'm using this trick in phpdbg_btree_insert_or_update to allocate the whole chain of nodes at once…
 
11:24 AM
:D
But then creating an interface for this to expose to userland is a whole 'nother ballpark
 
hey everyone :D
anyone there?
 
Mogguh @Jimbo
 
there is a problem, I need to Solar date, but using of DEFAULT NOW() gives me Gregorian date, what should I do ?
 
@Sajad You understand that the Gregorian calendar is a Solar calendar, no?
 
11:39 AM
what ? the gregorian is a solar ? how ?
solar: 1394/5/10
gregorian: 2015/1/1
 
@Sajad Solar calendars are ones based on the time spent during revolutions of the earth around the sun.
Whereas Lunar calendars are based on time spent during revolutions of the moon around the earth.
 
@Sherif Deep meaning :)
 
I think you're confused about the difference between a formatted date string and the calendar used for that date.
 
@Sherif yes I guess
 
How dates are stored in your database and how they are formatted to a human readable string remain two independent concepts.
For example: SELECT NOW() + 0; gives you 20150801074002.000000 whereas SELECT NOW() + INTERVAL 1 SECOND; gives you 2015-08-01 07:43:48
Clearly, format and storage are not interdependent concepts here.
 
11:45 AM
ah, wait ... I will test it
 
But, that's what you get when you use a tool that deceives you into believing you are interacting with your database when really all you're doing is interacting with the tool...
 
Look, Mysql stores like this:
2015-08-01 16:22:47
But I want like this:
1394-5-10 16:22:47
there is any solution ?
 
@Sajad It doesn't store it like that, but you could certainly format it like that.
@Sajad Solutions infer problems. Since you don't have a problem here, what you probably want is to become more knowledgeable about the subject matter in order to understand how to use it. As suggested earlier by @tereško. I'd suggest for example, you spend a little more time reading the manual to understand how these functions behave in MySQL and the trade-offs of the different data types involved.
 

« first day (1750 days earlier)      last day (3198 days later) »