Closed (won't fix)
Project:
Drupal core
Version:
6.x-dev
Component:
database system
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
2 Sep 2007 at 16:43 UTC
Updated:
14 Sep 2007 at 11:23 UTC
Jump to comment: Most recent file
Comments
Comment #1
chx commentedI asked hswong3i whether he uses preg_replace_callback from core:
Ever since Cvbge added preg_replace_callback to this often iterated function we suffer from this performance loss: http://drupal.org/node/10407#comment-56287
Comment #2
webchickThe summary of this issue seems to be:
- chx has found a small optimization that can be made by simply doing sprintf rather than preg_replace_callback(). While there appears to be no measurable difference in performance with just core, logically, preg_replace_callback is going to be slower. And multiply that by sites that take 200-500 queries per page in order to generate, and you're looking at something probably fairly substantial.
- hswong believes that we the _db_query_callback makes a lot more sense as a general API function for all databases, rather than each db backend having to implement its own, and believes that moving this logic to the db-specific abstraction layers is a step backwards. However, he admits he is not using the core _db_query_callback.
- Currently in Drupal 6, in order to workaround for the fact that D6 doesn't support LOB handling [http://drupal.org/node/147947], each database abstraction layer that requires it needs to implement this in its own file anyway. This is why chx is frustrated. However, this kind of code duplication isn't very clean (since more database systems support LOBs than don't) and will need to be refactored in D7 when we have "proper" database abstraction handling, and that's why hswong is frustrated.
Could we please get a final decision on this from someone on high?
Comment #3
hswong3i commentedI just can say nothing other than code implementation, and its benchmarking result: http://drupal.org/node/172541#comment-298711.
With keeping _db_query_callback() as public for number of benefits (on the other hand, extend its abstraction with number of new features), we are still able to keep our overall performance as existing implementation:
Hope we can further more review about the actually needs of isolating (or extending) _db_query_callback(). The patch provided is just used as technical preview for D7 (even though it is working out with D6 CVS HEAD, with number of benefits), but not trying to promote as core feature within D6. Surly that we are always able to re-roll it back into current implementation in future, but isn't it really meaningful for doing that? I will not oppose any action taken by core committer, but just trying to express my concern by code, testing, and benchmarking. Please take it easy, and simply ignore this comment if you think it is something meaningless, childish, and not professional enough :)
Comment #4
chx commentedOK, here is a bare patch which does not move _db_query_callback. It's not much of code to load -- I know you are not using iit -- you are using a custom version of it -- but ah well. Let's try to keep peace. And for god's sake do not answer, OK?
Comment #5
hswong3i commentedthe change seems very logical, and tested as function; i have no comment about it functionality, other than previous D7 technical preview; i guess we will asking for its benchmarking result, in order to have a final judgment, and so here it is (i reuse all DB, hardware, and drupal setting as http://drupal.org/node/172541#comment-298711):
hope this benchmarking result can speed up the discussion, and also help about finalizing it. hope we will able to release beta1 as soon as possible :)
Comment #6
dries commentedI don't see why this is 'critical', it looks 'minor' to me but I'll settle with 'normal'. I'm going to hold off committing this patch until I had the time to read up on the forked thread. I'll make my own judgement about what is "totally, absolutely off topic".
Comment #7
dries commentedI'm going to mark this "postponed". The performance tests show that this doesn't buy us anything so we can defer this discussion to Drupal 7. No harm done postponing this.
Comment #8
chx commentedI will be blunt: fuck those benchmarks! How many times should I reiterate that as there are no complex sites under Drupal 6 it's impossible to bench correctly. There is no doubt that preg_replace_callback is slower.
Comment #9
chx commentedThere is no API change so why this needs to wait? We already waited two releases to correct the harm the pipe dream of postgresql compatibility did to mysql performance.
Comment #10
hswong3i commented@chx: First of all, if you are questioning about the effectiveness (or even its fairness) of these benchmarking result, I will suggest for a benchmarking (or something relatively solid than just talking about "There is no doubt that preg_replace_callback is slower.") from YOU. On the other hand, I would like to quote my previous comment once again (http://drupal.org/node/172008#comment-299398):
Secondly, the need of the function hook is very clear: this is a very important hook for ALL OTHER DATABSE DRIVER (including pgsql and pdo_mysql), the remove of this function hook will ONLY benefit on current mysql and mysqli implementation. I would like to refer this topic to my latest research result (http://drupal.org/node/172541, http://edin.no-ip.com/html/?q=node/310 and http://edin.no-ip.com/html/?q=node/312), and it is something shouldn't mention once and once again within this issue. Please feel free to comment about that progress if you have any question.
Moreover, D7 is not too far from today: it should be open after 1~1.5 month from today, as we will have D6 beat1 within days. This is according to previous case in D5: we have beta2 1 month after beta1, and stable release 4~5 days after beta2. This case of D6 and D7. Without a relatively solid supporting, we shouldn't be too hurry about committing this patch (as it just propose 4 days before scheduled beta1 release), but postpone this discussion into D7.
Finally, the only comment that I can give about this patch is: THIS IS A CONSPIRACY! This is the first step of dropping ALL THE CHANCES of other databases supporting from Drupal core (including PgSQL and pdo_mysql)! The remove of preg_replace_callback() will give a very BAD IMAGE to other developers, when we are talking about develop other database driver for Drupal core: we will seems the need of this useful function hook as a lossy and meaningless additional handling; but it is required for ALL databases driver, just other than today's mysql/mysqli drivers; the contribution of other databases will become something not favour, as MySQL already own our current 90%+ of user base, and it don't need this additional handling. I guess your position is need not to doubt: this patch is not talking about performance boost nor reduce difficulties of code maintenance, but a STRIKE to other databases driver development (http://www.drupal4hu.com/node/64)!:
P.S. your position about keeping abstraction layer for PDO supporting is totally meaningless: if MySQL 5.0 (and soon 5.1) will be the best, and should be the one and the only one of our choose (says together with PHP 5.x) on today, we should DROP ALL DATABASE ABSTRACTION LAYER FROM TODAY, AND WRITE NATIVE PHP 5.x + MYSQL 5.0/5.1 QUERIES WITHIN DRUPAL CORE! If we are considering about performance boost, reduce buggy code, and decrease the difficulties of development, it is meaningless for keeping these fancy and lossy abstraction, even for backward compatibility with MySQL 3.x/4.x, and forward compatibility with PDO + MySQL. Building an abstraction layer without consider about the needs of other databases is just a very silly joke (http://www.drupal4hu.com/node/64) :
Comment #11
hswong3i commentedComment #12
chx commentedYou still make no sense. You are free to use your own version of preg_replace_callback in your driver -- which you admitted having. Nothing new in your post. My blog post and future discussions are irrevelant to this issue.
Comment #13
dries commentedThis issue will be "won't fix"ed then. No one will get killed by not having this in D6, and it leaves the door open for more database backend exploration work. It's irrelevant for Drupal 7 anyway.