News for hackers. Stuff that matters.
Re:A Not-Called Function Can Cause a 5X Slowdown by CoolGuySteve on Tuesday December 04, 2018 @07:50AM (#18598912)
Windows has a real problem with huge monolithic dlls that inexplicably pull in other huge monolithic dlls. Especially when each dllmain() has its own weird side effects. It leads to bizarre behavior all the time such as this.

The weirdest thing that ever happened to me was when Visual Studio 2012 hung in the installer. After debugging with an older VS, it turned out the installer rendered some progress bar with Silverlight, which was hung on audio initialization, which was hung on a file system driver, which was hung on a shitty Apple-provided HFS driver. Uninstalling HFS fixed the installer.

Why does an installer even need audio when it never played sound? Because Microsoft dependencies are fucked.

Re:A Not-Called Function Can Cause a 5X Slowdown by userbinator on Tuesday December 04, 2018 @08:14AM (#18599111)
Getting even more to the point: why does an installer even need to use Silverlight to render a progress bar!?!? As far as I know, these things have been there since 16-bit Windows and continue to work fine in Win10:

https://docs.microsoft.com/en-us/windows/desktop/controls/pr...

Re:A Not-Called Function Can Cause a 5X Slowdown by jcelerier on Tuesday December 04, 2018 @09:09AM (#18599499)
> continue to work fine in Win10:

putting the head in the sand like this won't make the problem go away. UX designers demand stuff that is smoother than win32 progress bars, that has spline-interpolation-like behaviour with some nice little tween at the end when going to the next page, with varying smooth color gradients all over the place.

go make this UI with pure Win32 primitives : https://youtu.be/v0GG8uh80V4?t=158

Re:A Not-Called Function Can Cause a 5X Slowdown by rkagerer on Tuesday December 04, 2018 @10:25AM (#18600194)
I hate animations like that.

All they do is distract me, waste my time while I'm waiting to see and interact with the next thing, and move my target out from under me while I'm trying to go click it. I always turn off all the animation settings right out of the box.

I wouldn't be surprised if one day soon this fad gives way back to a renaissance of clean, simple, instant UI's and everyone will feel like their devices got a lot snappier.

Re:A Not-Called Function Can Cause a 5X Slowdown by jcelerier on Tuesday December 04, 2018 @11:17AM (#18600748)
> I wouldn't be surprised if one day soon this fad gives way back to a renaissance of clean, simple, instant UI's and everyone will feel like their devices got a lot snappier.

facebook introduces artificial delays in the loading of their stuff because people wouldn't believe that it actually works when it is too fast

Re:A Not-Called Function Can Cause a 5X Slowdown by GoodDreams on Tuesday December 04, 2018 @12:11PM (#18601332)
Similarly travel booking sites add an artificial delay otherwise travelers don’t believe the site tried hard enough to find the best deals.
Re:A Not-Called Function Can Cause a 5X Slowdown by corysama on Tuesday December 04, 2018 @01:12PM (#18602011)
TurboTax Online is just an hour long series of delays to give the impression that server farms are struggling to do work that could be handled instantly by a Commodore 64.
Re:A Not-Called Function Can Cause a 5X Slowdown by bradstewart on Wednesday December 05, 2018 @10:32AM (#18609087)
Wow. Do airlines do this as well? I literally will not fly American Airlines anymore because their website is so unbearably slow when looking for flights (not that United or others are much better).
Re:A Not-Called Function Can Cause a 5X Slowdown by phailhaus on Tuesday December 04, 2018 @10:51AM (#18600471)
> I wouldn't be surprised if one day soon this fad gives way back to a renaissance of clean, simple, instant UI's and everyone will feel like their devices got a lot snappier.

No, don't think so. Instant UI's are disorienting because there's no visual cue for what is about to happen, and they don't give your brain an intuition as to how the interface behaves (e.g. a sidebar slides in from the side rather than the top). We're used to instant UI's because we've learned the patterns over time, but they're very unnatural to new/ocassional users. Some interfaces overdo the animation timing though, they can be very fast and still give users enough of a cue to understand what happened.

Re:A Not-Called Function Can Cause a 5X Slowdown by Retric on Tuesday December 04, 2018 @11:17AM (#18600751)
Animations that change colors within a narrow range are fine, moving UI elements around is a huge anti pattern that annoys users without any benifits.

It’s the same issue as flat buttons, users need to know what’s clickable, and what has been clicked. They don’t need shading etc, but feedback has masssive utility. Sadly, our field generally lacks the kind of real feedback that corrects such incompetence.

Re:A Not-Called Function Can Cause a 5X Slowdown by phailhaus on Tuesday December 04, 2018 @06:07PM (#18604343)
> moving UI elements around is a huge anti pattern that annoys users without any benifits.

Still disagree, and I think you're thinking of really obnoxious examples. I'm imagining about a ~150ms animation for the following:

1. A sidebar sliding out from the side

2. Dialogs swooping in and out from the top of the screen

3. Form panes sliding out when replaced

These quick, almost-no-time visual cues are incredibly important at giving your interface a sense of presence and physicality. Without them, your UI elements are flickering in and out of existence without any perceivable reason, and can often leave the user wondering what changed.

Re:A Not-Called Function Can Cause a 5X Slowdown by Retric on Wednesday December 05, 2018 @07:34AM (#18607646)
That still just adds perceived lag to the system slowing people down as you can’t read something that’s not yet rendered or sliding around that quickly. 150ms adds up.

“Why did this get so slow?” Is a real and common complaint with such changes and why OS’s allow people do disable so many animations.

Re:A Not-Called Function Can Cause a 5X Slowdown by phailhaus on Wednesday December 05, 2018 @10:23AM (#18608985)
The "why did it get slow" complaints happen when the animations aren't fast enough. The brain doesn't need a lot of time to register motion, but many times designers will use a slow and laborious animation to really emphasize something appearing. See Google's material design: it is based on the philosophy that interfaces should behave physically, and you'll see that it feels incredibly snappy.

Check out these demos: https://material.io/design/motion/speed.html

Example: you can't effectively convey a menu becoming a button without an animation. Without an animation, the menu disappears and a button appears, but there's no reason to believe that they're related. A 100ms tween from one to the other is all you need. Our brains are very good at relating motion, not objects blinking in and out of existence.

Re:A Not-Called Function Can Cause a 5X Slowdown by Retric on Wednesday December 05, 2018 @10:53AM (#18609344)
100ms * even a minimal 20 actions per minute = 16 minutes wasted in an 8 hour work day.

Remember, those 100ms delay gaining information which also delays every action that happens after them. So, the cost is real.

Worse, people can break 200 actions per minute for well known systems. Which makes this far worse as it’s slowing people down more as they try and get more done.

Re:A Not-Called Function Can Cause a 5X Slowdown by flukus on Wednesday December 05, 2018 @12:47AM (#18605952)
The human brain dedicates quite a bit of hardware to some of the best visual diffing algorithms in the known universe. Animations just confuse those algorithms.
Re:A Not-Called Function Can Cause a 5X Slowdown by phailhaus on Wednesday December 05, 2018 @01:30AM (#18606111)
Um, this is absolutely false. There's actually a very famous optical illusion that proves that humans are extremely bad at visually diffing without animations. If you switch between two pictures but separate them with a black screen, you will have a hard time figuring out what changed. The brain is extremely good at detecting movement, not "find the ten differences".

Here's an article that shows gifs that demonstrate the illusion:

https://www.thisisinsider.com/spot-the-difference-braintease...

Re:A Not-Called Function Can Cause a 5X Slowdown by flukus on Wednesday December 05, 2018 @01:52AM (#18606194)
Separating things with a blank screen isn't representative of a visual element suddenly appearing/dissapearing though. If they have to resort to that to confuse you then it shows that the brain is good at spotting the difference, it's almost like adding an animation if anything, a fade out and back in. This is also with a far more complex scene than most programs, so again not representative.

Get rid of the blank screen in-between and tell me people have trouble spotting the difference.

Re:A Not-Called Function Can Cause a 5X Slowdown by phailhaus on Wednesday December 05, 2018 @10:19AM (#18608929)
> Get rid of the blank screen in-between and tell me people have trouble spotting the difference.

If you blink, you'll miss it. That's the problem: if you're not directly looking at the part that's changing (or near it), you'll miss it. Either way, our brains are not wired up to expect objects to suddenly blink into existence.

Re:A Not-Called Function Can Cause a 5X Slowdown by calcifer on Tuesday December 04, 2018 @10:28AM (#18600224)
> UX designers demand stuff

Really? Demand? This is an installer that you will see maybe once a year, probably not even that. You will forget everything about it the moment it terminates, so why not use the default progress bar the OS provides and call it a day?

Re:A Not-Called Function Can Cause a 5X Slowdown by phailhaus on Tuesday December 04, 2018 @10:52AM (#18600477)
The installer is the first impression your user will have of your application.
Re:A Not-Called Function Can Cause a 5X Slowdown by sid- on Tuesday December 04, 2018 @11:18AM (#18600767)
And that hanging leaves a great impression :)
Re:A Not-Called Function Can Cause a 5X Slowdown by fredsanford on Tuesday December 04, 2018 @05:16PM (#18604088)
Then most companies have impressed on me that they hire chimpanzees to design/code Windows installers and the like.
Re:A Not-Called Function Can Cause a 5X Slowdown by userbinator on Wednesday December 05, 2018 @09:34PM (#18614893)
go make this UI with pure Win32 primitives

I happen to be both a demoscener and Win32 programmer, so I know exactly how to do those sorts of effects without bloat. That doesn't mean I necessarily advocate doing it, however.

It's ironic that you mention fancy progress bars, when the ones in the VS installer are even less fancy than the built-in OS ones. 2 colours, no 3D border, not even a gradient.

One of my annoyances is applications which reinvent standard OS controls and UI. The OS has (or unfortunately, more like had these days... but that's a different rant) theming and customisation capabilities for a reason. Don't try to be different just for the sake of being different, you'll stand out and not in a good way. It's an accessibility issue too: what happens when your custom-rendered UI is run on a system where the user has configured a custom colour palette (because he/she is colourblind, or just finds some colour combinations easier to use)? The OS UI widgets all have a consistent style and change all together, more than can be said of custom UIs.

(In applications like games, it often makes perfect sense to build a custom UI because it's part of the gameplay experience; but for a productivity application, a custom UI just gets in the way.)

Re:A Not-Called Function Can Cause a 5X Slowdown by phaedrus on Tuesday December 04, 2018 @09:51AM (#18599851)
Granted Microsoft sets a particularly egregious example here, but the way we (don't) track dependencies is f'ed up across the whole software industry. It should be (nay, needs to be) possible - in an automated way, with a visual UI - to see a piece of software as a cloud of features and click and drag away or cut+paste and get JUST the parts of the code the feature ACTUALLY requires. Yes, like dependency inversion, but I'm talking about all the way down to the assembly instructions level.

Before you object that that's just not possible: yes, but only because we've already scrambled the eggs and can't unscramble them. The problem is the way we develop(ed) the whole stack (down to the assembly language and kernel calls level) is bass ackwards. Consider that the foundations of how everything is organized (vis a vis dependency injection or lack thereof in low level libraries) dates back to a time when computers were many orders of magnitude smaller and you were expected to have a good idea what was in the libraries you included. Now, the situation is reversed - you have no idea what's in the libraries you include and no idea what they include, etc. But we still program as if it should be the responsibility of the user to understand the library / program and what it uses transitively.

Re:A Not-Called Function Can Cause a 5X Slowdown by tenaciousDaniel on Tuesday December 04, 2018 @10:07AM (#18600005)
> a visual UI to see a piece of software as a cloud of features and ... get just the parts of the code the feature actually requires

oooohhh I love that idea. I wonder if this could be utilized for npm.

Re:A Not-Called Function Can Cause a 5X Slowdown by phaedrus on Tuesday December 04, 2018 @10:55AM (#18600501)
I've been thinking a lot about Software Archeology, trying to envision what that might be. I think we don't even have the tools yet to do a Site Survey. Somehow I can't fully envision what those tools would look like, but this is my best attempt to describe the vague picture in my head.
Re:A Not-Called Function Can Cause a 5X Slowdown by fit2rule on Tuesday December 04, 2018 @10:14AM (#18600081)
I'm seeing it being at least a bit feasible with package managers that allow the ability to config/build packages and install them locally according to needs by the developer .. something like Gobolinux with its bundle garden, combined with a configuration-management tool that can build every package with every possible configuration ..

Bit of a goose, though. As in, not sure it'll fly in its current (scrambled eggs) state. Perhaps a rewrite is really what's needed .. or maybe HaikuOS can deliver this without much ruffling of feathers?

Re:A Not-Called Function Can Cause a 5X Slowdown by phaedrus on Tuesday December 04, 2018 @11:06AM (#18600633)
Imagine if the provenance of every code line or machine instruction was tracked all the way from what the human wrote to what the machine executes. Combined with data flow analysis, itself combined with runtime analysis via a feedback process like Profile Guided Optimization.

The outcome would be somewhat like a package management tool, but one which can subdivide & prune a package even if the original author wrote it monolithically.

It could also provide feedback in the IDE showing which lines are "dead code" that don't contribute to the features which you've declared (via tests) are important.

Re:A Not-Called Function Can Cause a 5X Slowdown by tenaciousDaniel on Tuesday December 04, 2018 @11:04AM (#18600611)
Yeah I agree. What OP is describing would require an architectural shift in the way npm packages are built, IMO.

Sidenote, this is related, and pretty interesting: https://npm.anvaka.com

Re:A Not-Called Function Can Cause a 5X Slowdown by ep103 on Tuesday December 04, 2018 @12:09PM (#18601312)
Visual Studio's Code Architecture Diagrams are a good idea for how this could look and work, I think. Its basically just missing a "Crop all code outside this dependency chain" for any given function
Re:A Not-Called Function Can Cause a 5X Slowdown by Ajedi32 on Tuesday December 04, 2018 @03:07PM (#18603178)
Isn't that pretty much what tree shaking does? Webpack has had that for quite some time now (except fully automated, without the UI).
Re:A Not-Called Function Can Cause a 5X Slowdown by tenaciousDaniel on Tuesday December 04, 2018 @03:14PM (#18603220)
I think tree-shaking is made for finding dead code? Seems like the goals are intertwined though.
Re:A Not-Called Function Can Cause a 5X Slowdown by DrScientist on Tuesday December 04, 2018 @11:46AM (#18601070)
Personally I don't like tooling that magically does transitive dependency management - it creates the problem of bloat by making it too easy to add stuff - stuff that typically never gets removed.

Doing dependency management at the shared library level rather than source level, also results in massive bloat - you might only need one call for a library, but the whole library and all it's dependences, and their dependencies etc etc get pulled in - a ridiculous mess - then you have the whole different versions of libraries problem.

Things like npm, maven etc are the problem, not a solution in my view.

Re:A Not-Called Function Can Cause a 5X Slowdown by kjeetgill on Wednesday December 05, 2018 @04:38AM (#18606852)
Dependency management is a tremendous quality of life improvement, but you're not wrong: deep webs of dependency suck.

The Java ecosystem is a better about this than npm, but good public libraries need to make the aesthetic choice to keep minimal dependencies.

Helper/toolkit libraries like Guava or Lodash should pretty much be end user only. Your gzip library doesn't need em.

I get they're convenient, but if you're going to use 3 helpers in 5 places just fork those little bits and add them to your own codebase. DRY is for applications not libraries.

I like to see dependencies no more than 5 deep which is usually at the edge of manageability. For Java the critical path looks like:

Internal framework -> internal client lib -> RPC lib -> serialization -> bytecode hackery lib

Re:A Not-Called Function Can Cause a 5X Slowdown by MagicPropmaker on Tuesday December 04, 2018 @03:15PM (#18603235)
There's also the problem that Apple refuses to write decent software or follow the rules on Windows (which is why your Apple HFS driver failed.) Microsoft, on the other hand, writes some of the best MacOS and iOS software.
Re:A Not-Called Function Can Cause a 5X Slowdown by goalieca on Wednesday December 05, 2018 @08:55AM (#18608164)
Wait, so an IDE installer pulling in a web framework for .net that initializes an audio driver that requires HFS all So that a progress bar can be better than their own native one (pick an API whether wpf, win32, ...) one is somehow not Microsoft’s fault to some degree? I find it really hard to believe they write some of the best iOS/ macOS software if they release this shit on windows.
Re:A Not-Called Function Can Cause a 5X Slowdown by juliangoldsmith on Tuesday December 04, 2018 @11:31AM (#18600904)
I've never gotten the hate for static linking, which would avoid issues like this. You'd always have the version of your dependencies that you're expecting.

Also, dynamic linking completely neuters LTO. There's not much point to (theoretically) saving a few megabytes of RAM when you're pulling in twice as much unused code.

Re:A Not-Called Function Can Cause a 5X Slowdown by cesarb on Tuesday December 04, 2018 @01:13PM (#18602024)
> I've never gotten the hate for static linking

I believe most of the dislike for static linking can be traced to a single incident: a really bad (as in "remote code execution" bad) vulnerability in zlib, CVE-2002-0059. Back then, it was common to statically link to zlib (and zlib is a very popular library, the DEFLATE algorithm it implements being the "standard" compression algorithm), so instead of just replacing a single dynamic library and rebooting, everything had to be audited for the presence of embedded copies of zlib.

Quoting from a message from a few years later (http://mail.openjdk.java.net/pipermail/build-dev/2007-May/00...):

"[...] Updating the main system zlib package was easy, but finding all the embedded copies was a nightmare. I think we ended up grepping every binary and library in every package for symbols and other bits of code that looked like zlib. All the different versions involved compounded this. And when everything is found and patched and built and tested there's the cost of bandwidth to distribute all the extra stuff. So when people talk of removing static libraries they're talking about real costs -- time and money. After zlib there was a definite feeling of "never again"."

Re:A Not-Called Function Can Cause a 5X Slowdown by Hello71 on Tuesday December 04, 2018 @01:34PM (#18602246)
That's not a complaint about static linking though, that's a complaint about library embedding. Lots of Professional Enterprise Software as well as poorly designed games use a buttload of dynamic linking, but a few patches here and there and some API/ABI ignorance later, the libraries are impossible to replace.
Re:A Not-Called Function Can Cause a 5X Slowdown by TFortunato on Tuesday December 04, 2018 @03:06PM (#18603164)
Unfortunately, this is conflating static linking with bad dependency management. ("Just copy it into your own repo", is a different step, that is unnecessary to do the second step, "and link it statically")

There is no reason I see why you couldn't just have a build that produces the library .a file for zlib, which can then be pulled in as a dependency of your build / linked in statically.

I totally agree, they had a nightmare situation on their hands, but I don't think static linking was solely to blame :-)

Re:A Not-Called Function Can Cause a 5X Slowdown by tedunangst on Tuesday December 04, 2018 @03:51PM (#18603497)
I have 100s of binaries on my system. Which ones do I need relink?
Re:A Not-Called Function Can Cause a 5X Slowdown by juliangoldsmith on Tuesday December 04, 2018 @04:15PM (#18603663)
You can write a script to look at package files' makedepends, and rebuild everything that uses the offending library.
Re:A Not-Called Function Can Cause a 5X Slowdown by tedunangst on Tuesday December 04, 2018 @03:54PM (#18603516)
> There's not much point to (theoretically) saving a few megabytes of RAM when you're pulling in twice as much unused code.

But there is. The unused code is still shared.

Re:A Not-Called Function Can Cause a 5X Slowdown by caf on Tuesday December 04, 2018 @10:13PM (#18605431)
...and the libraries are typically demand-paged as well, so the truly unused stuff isn't even resident.
Re:A Not-Called Function Can Cause a 5X Slowdown by juliangoldsmith on Wednesday December 05, 2018 @12:56PM (#18610667)
That would assume that used and unused code aren't mixed within pages.
Re:A Not-Called Function Can Cause a 5X Slowdown by juliangoldsmith on Tuesday December 04, 2018 @04:18PM (#18603678)
That might make a marginal difference if you have large libraries that are used in a large number of applications that run concurrently. Otherwise, the sharing is completely pointless.
Re:A Not-Called Function Can Cause a 5X Slowdown by pathseeker on Tuesday December 04, 2018 @11:49AM (#18601107)
>I've never gotten the hate for static linking

vulnerabilities

Re:A Not-Called Function Can Cause a 5X Slowdown by DrScientist on Tuesday December 04, 2018 @12:23PM (#18601465)
Sure - but most computers are used by people who are the sole user, so local user to user security as a concept isn't useful.

Most code isn't part of the remote attack surface.

Also there would be no software bugs if bugs only existed in the past... ie bugs come with updates, not just fixed by updates.

There are trade offs, and Linux developers decided to make it what was easiest for them and remove the ability for the user to choose.

If there wasn't a need for stability and isolation then docker et al wouldn't exist.

Re:A Not-Called Function Can Cause a 5X Slowdown by juliangoldsmith on Tuesday December 04, 2018 @01:28PM (#18602192)
Based on what cesarb said, that's a problem with the build system.
Re:A Not-Called Function Can Cause a 5X Slowdown by eridius on Tuesday December 04, 2018 @06:49PM (#18604576)
What was the HFS driver hung on?
Re:A Not-Called Function Can Cause a 5X Slowdown by agumonkey on Tuesday December 04, 2018 @07:54AM (#18598936)
It's a mystery how MS manages to exist. Or maybe it's just consumer market emergent chaos mastery.