Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Crazed20367y1) how often is i incremented?
2) why is the limit hard-coded?
3) why is a new Date being created every iteration (holy performance Batman)
4) how long will this actually run??
Did I miss any big problems? I'm new someone help me troubleshoot this monstrosity -
It's only used in one file, for 100ms sleeps. Purpose is unknown but as far as I deduce it's used at the end of the iteratee of a very convoluted for loop, possibly to "make sure" the current iteration is finished before moving on.
-
On current CPUs it actually has a fairly good chance of blocking for approximately 100ms, but cranking the time up will lead to unexpected results 😀
-
devios157017y@Crazed Lol you're worried about performance? It literally stalls the browser until the time is elapsed.
-
devios157017y@Crazed Well the apparent point of this monstrosity is to be as intentionally un-performant (is that a word?) as possible, in order to stall all execution for a given time.
…which is terrible practice because it will very likely also stall the whole browser, or at least slow it down, when a timeout could have been used to do it asynchronously and …performantly.
Related Rants
Just found this in a legacy Angular1 app. It's in production btw.
undefined
sleep
js
sleep deprivation