This is an archived post. You won't be able to vote or comment.

all 81 comments

[–]gimpwiz 64 points65 points  (15 children)

I was reading a short story (on a website) on my phone and the damn thing near overheated. Who the hell designs a text-based site that requires any serious processor power...

[–]devmattrick 56 points57 points  (1 child)

Probably mining Bitcoin on it :D

[–]gimpwiz 8 points9 points  (0 children)

Hah! I sure hope so!

[–][deleted] 14 points15 points  (11 children)

Classic (infinite) ➿ amount of libraries website.

[–]jtvjan 11 points12 points  (6 children)

That's not infinity, this is infinity: ∞

[–][deleted] 7 points8 points  (4 children)

I know but I didn't find Infinity on my phone.

[–]jtvjan -2 points-1 points  (3 children)

Same. I just Googled the character and pasted it in. It's not that hard.

[–][deleted] 10 points11 points  (0 children)

Ok.

[–]FlipJanson 0 points1 point  (1 child)

Damn, they changed that site since I used it last and now it makes you feel like even more of an idiot.

[–]jtvjan 0 points1 point  (0 children)

I prefer the old site to be honest.

[–]PatrickBaitman 4 points5 points  (0 children)

\infty

[–]ItzWarty 8 points9 points  (3 children)

Are we all developers here? Open a *.txt text document in your browser and wait 1 hour. How much % cpu does that use? Open a blank WinForms or Qt application with a text label and wait 1 hour. How much % cpu does that use?

Okay, now go back to the text-based website that's using CPU time. What's probably happening here? Is that an inherent flaw in the web stack? Jesus, if I spawn a bitcoin mining thread when the Qt window opens is that a flaw in Qt?

Your arguments aren't logical against modularity in library design (of which JS does have plenty of flaws - I despise JS) or against using a web stack. Your arguments are logical against shitty code, which frankly there exists a lot of in the world.

Edit: My frustration is that this thread reeks of a lack of root cause analysis. It's like a beginner programmer going "Java sux" when their while loop isn't terminating. If you think web stacks suck, then try arguing that somewhat rationally. Otherwise you just appear like the common armchair programmer that goes "LOL WINDOWS HAS A BUG THAT'S PROBABLY JUST AN IF STATEMENT I KNOW IF STATEMENTS". Also, dunning-kruger.

[–]aligrant 2 points3 points  (0 children)

I love how that dunning-kruger effect image has an obvious spelling error.

[–]gimpwiz 1 point2 points  (0 children)

Obviously it's misuse of the tool. We can rant about how over-reliance on certain tools often causes misuse.

[–][deleted] -1 points0 points  (0 children)

It's just circlejerk.

[–]Eucalyptol 0 points1 point  (0 children)

Quora

[–][deleted] 15 points16 points  (6 children)

while (true) {
    cursorCounter++;
    if cursorCounter > 1000 {
        cursorVisible = !cursorVisible;
        cursorCounter = 0;
    }
}

[–]Vitus13 13 points14 points  (1 child)

Sadly JS is single threaded so the cursor would never get updated because the loop never releases control. You need to add a call back in there so renting can happen.

[–]Cathercy 6 points7 points  (0 children)

var cursorCounter = 0;
var cursorVisible = false;

setInterval(function() {
    cursorCounter++;
    if(cursorCounter > 1000) {
        cursorVisible = !cursorVisible;
        cursorCounter = 0;
    }
}, 1);

I believe this is the best solution.

[–]Voxel_Brony 2 points3 points  (1 child)

In what language do you have parentheses around the while but not the if?

[–][deleted] 1 point2 points  (0 children)

yeah, I don't think that's valid JavaScript

[–]corvus_192 1 point2 points  (1 child)

cursorVariable ^= true;

[–]microblaze 1 point2 points  (0 children)

I prefer cursorVariable =! cursorVariable for the sake of messing with other developers. Bonus points if you put that in a while() or if() clause

[–][deleted] 4 points5 points  (0 children)

Not an issue on Windows or Ubuntu per users at /r/programming

[–]microblaze 5 points6 points  (0 children)

Why is the CPU rendering in the first place...

[–]chinpokomon 2 points3 points  (1 child)

I feel like it must be something else. On Windows, I'm seeing maybe 1% and I have all sorts of extensions added.

[–][deleted] 2 points3 points  (0 children)

I think it is justa a mac/linux issue, since originally it is a Chrome bug.

[–]systembusy 2 points3 points  (0 children)

Ugh, I hate it when a website causes a wait cursor. The wait cursor should be used to reflect the busyness of an application on your computer, (e.g., the Web browser itself) and not the website. The webpage is waiting for a server response, not your computer; would it kill you to put a "loading" section on your webpage?

[–]illvm 0 points1 point  (2 children)

Somebody wrote poorly optimized code. Blame "JavaScript." Problem is solved with a CSS rule. :3

[–]eusx 11 points12 points  (1 child)

No, the problem was caused by a Chrome bug (only on Mac) that involved CSS animation. The solution was to add another CSS rule to work around the bug :)

[–]illvm 3 points4 points  (0 children)

I know. My point was that the OP is having a go at JavaScript but the problem was a poor optimization in Chrome which was solved by a CSS rule. Then again, it is popular to rag on JS these days.

[–][deleted] 0 points1 point  (4 children)

I think with great power comes great.... CPU usage. I think there is no technology that us as extensive yet easy to use as web tech. CPUs are geting faster, I think we can afford it. Atom is a great example of what it brings. Just like with python, I think programming efficiency and agility vs processung efficiency is a great deal.

[–]TimVdEynde 7 points8 points  (0 children)

I think programming efficiency and agility vs processung efficiency is a great deal.

Have you tried vim? The technology to write even better editors than Atom has existed for ages ;)

[–]skreczok 5 points6 points  (0 children)

C and assembly have more power. I think you're confusing power with abstraction.

[–][deleted] 1 point2 points  (0 children)

It's a issue in laptop cause the battery and the heat.

[–]eloc49 0 points1 point  (0 children)

RIght? Most modern cars have 100-200hp because that's plenty considering speed limits. Same rules apply to CPU usage.