|
|
|
| Hurry! Enter The Daily WTF's OMGWTF2 Contest by June 28th! - Prizes! Fame! Trophies! Do your worst: http://omg2.thedailywtf.com/ |
| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Page 5 | Next » |
Re: The Speed-up Loop
2008-01-29 09:51
•
by
Evil Otto
(unregistered)
|
|
Then the user would complain about having to click OK every time they saved something.
Sometimes the clients need to be protected from themselves. |
|
Actually, the rule is that 80% of the work takes 20% of the time, and the other 20% of the work takes 80% of the time.
|
Re: The Speed-up Loop
2008-01-31 03:26
•
by
david
(unregistered)
|
WTF? random delays don't solve that problem unless you are lucky. You need to synchronize with the screen update, which you do by hooking an interrupt or looping until the video register clears - not an empty loop |
Re: The Speed-up Loop
2008-01-31 03:46
•
by
david
(unregistered)
|
Last I knew, editor word count was designed for reporters and other people who actually used it - and it was a letter count, because newspapers and magazine specified, laid out, and paid that way. So 892 'words' in most editors meant something like 3568 characters. Or has that changed? |
Re: The Speed-up Loop
2008-01-31 04:11
•
by
david
(unregistered)
|
gcc can and does optimise away an empty loop, or anything after an absolute return statement. It will optimise away for (i = 0; i < 1000000;i++); for (i = 0; i < 1000000;i++){} for (i = 0; i < 1000000;i++){i=i;} However, it will not optimise away for (u = 0; u < -1;u++){ process_command(wait_for_command()); } Or other obvious optimisations, even on -Os, and of course suffers from the limitations of the language definition when it comes to optimisation. Part of that has been addressed by changes to the language definition (for example, strict aliasing), but it is still a far cry from languages which were designed with code optimisation in mind. |
Re: The Speed-up Loop
2008-02-02 06:20
•
by
int19h
(unregistered)
|
|
The loop will get optimized by the JIT compiler later on. Most .NET compilers don't optimize aggressively, because they know that all the serious optimizations (e.g. function inlining, even constant folding) will be done at run-time.
The way to check is to run the program in VS and switch to disassebly. Only you first need to find the obscure "Suppress JIT optimizations when debugging" checkbox somewhere in VS options dialog, and turn it off; only then you see what actually is executed when your program runs standalone. |
Re: The Speed-up Loop
2008-02-06 04:27
•
by
Chris
(unregistered)
|
|
It's in the for loop. A signed int is limited to 32768, but the loop goes way further. I feel dumb because i can't remember how to work out how that pointer would look after the loop.
|
Re: The Speed-up Loop
2008-02-18 14:50
•
by
Majax
(unregistered)
|
|
in the for loop he increments an int from 0 to 1000000
int i; for (i = 0; i < 1000000;i++) problem is an int doesn't pass 65535 check: http://en.wikipedia.org/wiki/65535_(number) |
Re: The Speed-up Loop
2008-02-18 14:56
•
by
Majax
(unregistered)
|
|
I think the int would be -32768 if signed or go back to 0 if unsigned.
PS: Sorry, 65535 is the limit for unsigned int Chris is right about the 32767 limit for signed int. |
Re: The Speed-up Loop
2008-09-17 09:04
•
by
Mkay
(unregistered)
|
|
WTF ?!
you don't make a empty loop that is consuming resources (=CPU) and doing nothing (=waiting for some threading variable) ! go and see some thread synchronization methods please and don't spread this nonsense... |
Re: The Speed-up Loop
2008-09-17 09:07
•
by
Mkay
(unregistered)
|
|
sorry forgot the quote the guy with the
someThreadVariable = 400; while (someThreadVariable != 500); DeleteAllFilesInUsersHomeDir(); ^^^^ idea |
|
OK, so they're 16-bit integers and (presumably) pointer addresses as well. But without a malloc() or init to a static buffer, won't the line
char *p = 0x10000; simply result in a pointer to who-knows-where, and the deref in the loop: *p++ = 0; an immediate crash? (Or is this some ancient DOS magic memory address for some kind of device or O/S hook?) |
Re: The Speed-up Loop
2009-04-06 17:44
•
by
Daniel Smedegaard Buus
(unregistered)
|
|
TRRWTF here is that Windows 2.11 was on the market.
|
|
This story is such a classic gem, I keep coming back to read it again and again. The word "speed-up loop" has become a standard term where I work :)
|
|
80 20 rule is also known as the Pareto principle.
In software, the 80/20 rule is the ratio between program completion and time. You can get 80% of the work done in 20% of the time. The last 20% of work takes 80% of the time. |
If any version of VS really did what you wrote, it's a bug, and should be reported yada yada. Hopefully after you re-read your post, it'll be obvious why. This code doesn't "do nothing". It halts. IIRC, C spec does not allow optimizing halts away. Cheers, Kuba |
Re: The Speed-up Loop
2009-10-09 21:06
•
by
Mark
(unregistered)
|
I am positive some large? packages use a loop to make you think your getting some real meat when you install... Take Adobe CS2 - I mean how much does an install really have to do? copy some files and set the reg? Why is this taking 10-15 mins!! Watch it sometime. No disking, no cpu. Its a scam! |
Re: The Speed-up Loop
2009-10-09 21:40
•
by
Mark
(unregistered)
|
"Sometimes you need to get people to respect your knowledge and skill. Sometimes you can only do it by hitting them - even though we don't really want to." Omg, lol. You lie! |
Re: The Speed-up Loop
2011-11-11 12:58
•
by
forch
(unregistered)
|
It's actually 80% of a projects work is done in 20% of the calculated time, the rest of the 20% takes up 80% of the time ;) |
|
I admit doing this on a web application some seven years ago.
I just added a wait function, setTimeout(), with random time between say 500 and 5000 ms when saving a form. This way the waiting changed everytime and made it less obvious that the application was unoptimized. Then I just tweaked the values down a bit to improve speed. |
Re: The Speed-up Loop
2012-07-31 10:24
•
by
Cbuttius
(unregistered)
|
|
It isn't a speed-up loop of course, although I would use sleep() to not absorb CPU.
It's what is known in the market as the discriminatory pricing model, and it works in a way that you extract from people what they are willing to pay. So sometimes you purposely provide an inferior product so people who don't want to pay you as much can still have a product that works, whilst the rich ones will pay you more for a superior one. Normally that applies where you have a large market and want to sell to as many people as you can, but in this case it is sort of twisted to work for the current employer. Pay us more and we'll make your app faster.. Of course, here as they are "removing a 0" each time, it will only work until they run out of zeros to remove so they'd better have this in several places. |
|
OMG! I think I was working as support for the same application. Seriously!
|
Re: The Speed-up Loop
2012-08-06 08:31
•
by
agtrier
(unregistered)
|
|
In my experience, the first 80% of the project take up 120% of the time, the other 20% take another 80%.
|
|
A job like this would be a godsend in the modern day. 1 hour doing menial tasks, and the rest of the time could be spent learning the latest and greatest newfangled JavaScript frameworks or whatever. The only thing better would be a super lax IT environment where you could play games and stuff on your computer.
Get a fat paycheck for 1 hour of work and 7 hours of doing whatever you want? Fuck yes. Call me unethical all you want, but you know that would be paradise. |
| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Page 5 | Next » |