- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
The vast majority of that 1 sec call is likely constant with respect to the size of the database however.
The database access time is the only aspect that varies with the number of rows so it is the defining aspect of the algorithm's order of magnitude.
The original approach was probably implemented less than optimally as O(N) (or higher if joining tables) and the version with no count was probably O(1). That could mean multiple orders of magnitude, a 1 sec delay afterwards, and still far less than 6 min processing originally.
Admin
Ceci n'est pas un pipe.
Admin
Admin
In this case it's an open source project, so we could just find the responsible developer's name in the Subversion history and ask him directly. This could be a start of a WTF interview series: "What Were You Thinking?"
Admin
(In consideration of native German speakers, English to German auto-translation ommitted)
Admin
I would have to agree. You bring up some very valid points.
JT www.FireMe.to/udi
Admin
I don't care if the hard drive companies choose to use KB instead of KiB (KB is properly 1000 bytes, after all, following the metric system), but if you ever see a hard drive company advertise 1GB=1000KB, you've probably got them on some count of false advertising. And yes, if they made that statement, they would truly be depraved.
In other words, even you can say something completely wrong, intending that it wouldn't be over-analyzed, DHager.
Admin
Heh, is it PHPBB?
Admin
I used to consider SI/Metric as a rational system of measurement worthy of widespread use. Then I learned of their anachronistic attack on the digital world and realized that SI is pure evil and is the enemy of all civilization.
1kb never has and never will equal 1000bytes in any sane world. A 32bit architecture addresses 4GB of memory and any ludite who claims it addresses 4.294967296GB should be banned from computers before they can do any irreperable damage.
Admin
Assuming you meant "1GB=1000MB", it's even worse than that. Every major hard drive maker I've seen advertises with 1GB=1000,000,000B. (That means you get 93% of what they told you, for those that care)
Admin
Hey, don't go hating on metric just because when you say kibibyte, mebibyte, or (especially) gibibyte, you feel like you're entertaining a 2-month-old.
A 32-bit architecture addresses 4 GiB of memory...as an engineer I don't think I can see a future which uses GB to represent binary magnitudes in a non-ambiguous manner. We'll have to suck it up. It's unfortunate, given that there was absolutely no reason for the term to lend itself to factors of 1000 instead of 1024, except that it made some evil corporations' storage media look larger than they actually were.
Metric rocks because in the physical world, we deal in decimal. In computing, we deal in binary. Metric has absolutely no advantage in a binary world.
Admin
Well I wouldn't say this is a giant wtf as these things are pretty common in web development.
You have a query that does something fancy and smart that runs fine on your test server (with less than 100 rows in the DB). Then once deployed in a production environment it slows down like crazy.
I remember a friend asking me to help him with his osCommerce site. The menu for osCommerce used to (and maybe still do) do a select for each category you have in your database. This select also did some joins as far as I remember and the result was that when you had a few categories and a lot of products the menu took ages to load, 30 sec on his site.
Removed that code and it loaded in 0.3 sec. Now what did this magnificent code do? It displayed a count of the products in each category next to the category name.
Admin
At first, I thought it would have been adding different column names for each item in the cache, therefore maintaining a table with lots of columns, but a single row. While this is still rediculous, it was the only reason I could think they would be altering the table "on the fly".
Alas, either way that dev was smoking some rock.
Admin
Admin
Am I blind or didn't anyone notice the idiotic PHPism in the code block? The compare a variable to false with == which is true at least in two cases: when the variable is false and when it's 0.
How I love those idiots that designed some PHP functions to return either an integer or boolean depending on the result. Naturally they couldn't return -1 from strpos when no match is found. Instead, just return false and let the programmers understand that they have to compare with === to false and not with ==
Admin
Actually, I tested it further. Also the string '0' equals to false, naturally. So that's three cases of matching, though in this case the returning "handle" naturally is never ever ever 0 or '0', never ever...