News for hackers. Stuff that matters.
Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by dvdcxn on Thursday March 23, 2017 @12:04PM (#13941004)
I don't get this criticism. HTML/CSS is the closest we have to a universally understood syntax for designing interfaces.

Why invent a new standard? HTML is fine, CSS is fine. Most importantly, everyone understands it and can work immediately with it.

Any issues with performance is due to the implementation of the platform that renders this HTML/CSS interface. It's much more likely Google Docs feels sluggish due to the javascript it executes in order to control the rendering of its html/css, rather than the rendering itself.

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by yumaikas on Thursday March 23, 2017 @12:53PM (#13941531)
HTML and CSS are a bad fit for rendering heavy graphical interfaces because they fundamentally follow a document flow rather than grid-based layouts. Flexbox and css-grid are helping some in this area, but they are not used very often.

(not to say that HTML and CSS aren't useful, but they are far from the idea means of rendering a UI).

HTML does work fine when you use it for mostly document focused work, and I enjoy the interactivity and connectivity that web browsers have brought to the web, but I'd love to see an improvement on it all.

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by pcwalton on Thursday March 23, 2017 @01:08PM (#13941713)
Flexbox is that improvement.

If you discount flexbox due to "not [being] used very often", then you can't logically argue for burning down the HTML and CSS stack and replacing it with something else that has zero market share.

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by yumaikas on Thursday March 23, 2017 @05:00PM (#13944223)
My point wasn't so much that Flexbox isn't that improvement, but that I haven't yet had a chance to fully learn it, and I suspect that a lot of front-end developers are in a similar space. I plan on rectifying that soon, but it is yet another thing to add atop the large number of other things that comprise understanding modern web browsers.

I'm not saying that we should burn the HTML and CSS stack. It has served the web very well and will continue to do so, but until the last few years, it's been a document focused stack that's been twisted into doing app development, and in some sense, it still is.

HTML and CSS are not the best tool for heavy GUI development, a la Photoshop, Visual Studio (not VS Code) or other large GUI intensive things. Most web apps have yet to replicate the combination of features and/or performance of those types native applications. Flexbox is an improvement there that helps with layout, but that doesn't change the fact that we are working with the DOM under the hood, with all of its various quirks and performance issues. (Not to say other GUI frameworks/APIs are perfect, or necessarily better. Some of them just allow you to optimize a little closer to the metal).

One can point out that large GUI tools like Photoshop aren't being created as much these days, outside of AAA game dev, CAD, or the like, or that many large GUI's use web views to help display documents, a la Steam.

I sincerely hope that Servo's "Web Browsers are essentially AAA game engines" approach catches on.

I'd be interested to see how an event-based html5 canvas GUI library would compare to DOM.

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by dheera on Thursday March 23, 2017 @01:52PM (#13942208)
Q: How do you make a video maintain an aspect ratio and fill up the width of a parent? A: Nested div hell.

Q: How do you make an image maintain an aspect ratio and fill up the width or height of the screen, whichever comes first? A: Nested div hell and JavaScript.

Q: How do you make a scaled background image stay put even when the keyboard input pops up on a phone? A: Supreme JavaScript, CSS, and div hell.

Q: How do you center a paragraph of text vertically in a div? A: Nested div hell.

I'd say FlexBox is pretty inadequate. Why can't we have things like:

    #my-video {width:80%;height:calc(width*2/3);}
Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by pcwalton on Thursday March 23, 2017 @02:10PM (#13942395)
CSS object-fit handles your first two complaints, and CSS Variables handles your last one.
Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by Dylan16807 on Thursday March 23, 2017 @03:42PM (#13943444)
Aren't CSS Variables just constants you can reuse? How are they going to let you set width to 80% and height to 2/3 of whatever that ends up being?
Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by pcwalton on Thursday March 23, 2017 @04:14PM (#13943810)
Because percentages in heights are usually relative to the width of the containing block.
Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by kitsunesoba on Thursday March 23, 2017 @12:21PM (#13941193)
Just because it's the best we have (if you're looking for a cross platform solution, anyway) doesn't mean that we've reached the peak and can just quit. We can do a hell of a lot better, and doing anything less is tragically underselling ourselves. There are no laws of physics preventing a better solution from existing. No, creating something better isn't easy, but neither have any of the other technological breakthroughs.

HTML/JS/CSS is just a stepping stone like any other, not an endgame. Don't grow complacent with it. Demand something better.

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by thomastjeffery on Thursday March 23, 2017 @12:30PM (#13941292)
> it's the best we have (if you're looking for a cross platform solution, anyway)

No it's not. If you want a fast full-featured cross-platform GUI toolkit, there are many: GTK+ and Qt are especially great, and have bindings for several languages.

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by efdee on Thursday March 23, 2017 @12:59PM (#13941609)
I can't speak for Qt, but GTK+ is not that great outside of the Linux bubble. IMHO, of course.
Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by fetbaffe on Thursday March 23, 2017 @06:11PM (#13944818)
Qt is not that fun either, at least two years ago. Old style class hierarchies, clunky abstractions and awful build step (QMAKE). It got better with the use of lambdas, no longer necessary to have class to connect to a signal, lambda works as well.

However QML is an improvement. It was a bit quirky to get render the way you wanted and it was not native & look and feel, but maybe have gotten better since I used it. I could imagine that TypeScript + QML could be quite pleasant. Big downside is that the install size of your program is quite big.

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by sqeaky on Thursday March 23, 2017 @03:59PM (#13943660)
They aren't that great in the Linux bubble.

I say that from the developer and the user perspective.

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by symlinkk on Thursday March 23, 2017 @01:49PM (#13942171)
Qt isn't native. They're drawing their own widgets that look close to native - that's why you can theme Qt apps.
Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by dom0 on Thursday March 23, 2017 @02:33PM (#13942691)
Factually incorrect, since Qt uses native widgets when possible. Applying Qt stylesheets usually disables use of the operating system's styling engine, i.e. only then Qt starts drawing the widgets by itself. Widgets that are not part of the native widget assortment are drawn by Qt.
Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by symlinkk on Thursday March 23, 2017 @11:19PM (#13946341)
Then what is this blog post about? https://blog.qt.io/blog/2017/02/06/native-look-feel/
Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by dom0 on Friday March 24, 2017 @04:54AM (#13947555)
Qt Quick Controls which has nothing to with QtWidgets.

> Posted in Dev Loop, Qt Quick Controls, Styles

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by always_good on Thursday March 23, 2017 @12:37PM (#13941363)
"Quitting" is not how I'd describe Atom and VS Code.

You might not like the envelope they are pushing, but they are cutting-edge explorations into web tech, coinciding with other cutting-edge developments like HTML/JS -> Native interfaces.

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by FridgeSeal on Thursday March 23, 2017 @06:28PM (#13944923)
Are they really cutting edge? Or are they just an excuse to cram more javascript and web tech into unrelated areas.

Just because js is good on web, doesn't - and shouldn't - mean that we should be doing that.

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by dvdcxn on Thursday March 23, 2017 @12:25PM (#13941239)
There are now many more expressive languages which compile to HTML, CSS and JS. We are 'stuck' with these 3 technologies that are still very functional and we should just embrace them as the low level language of UIs.

Of the 3, javascript is the most dispensable, there's nothing stopping us writing platforms which have UIs designed in HTML/CSS but have a DOM controlled by python/c#/ruby.

I was not suggesting we stop progressing, but we need to recognise the phenomenal amount of overhead involved in replacing these 3 technologies. What benefit would be served when they can just be abstracted on top of, at least with regards to the web?

Case in point, Assembly Language, we could theoretically replace the standards that have been reached over decades of collaboration with something more suited to our modern leanings. But what would be the point, when we've long since abstracted it out of our minds?

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by panic on Thursday March 23, 2017 @01:28PM (#13941913)
Why invent a new standard? HTML is fine, CSS is fine. Most importantly, everyone understands it and can work immediately with it.

In order to render HTML, CSS and JavaScript, you need an entire web rendering engine. A new standard would let us get by with a lot less.

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by dragonwriter on Thursday March 23, 2017 @01:34PM (#13941987)
> In order to render HTML, CSS and JavaScript, you need an entire web rendering engine.

Getting to piggyback on V8 and Blink work is, I suspect, often a benefit rather than a cost in the eyes of developers of Electron-based editors. Sure, it's bigger resource load, but for use cases where the performance is acceptable, it's a lot less developer load to get the functionality out the door.

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by allendoerfer on Thursday March 23, 2017 @02:50PM (#13942879)
Until you have to reimplement even blinking cursors.
Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by dragonwriter on Thursday March 23, 2017 @03:14PM (#13943151)
No, even after that I'm pretty sure it's a net win in developer time.
Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by coldtea on Thursday March 23, 2017 @12:07PM (#13941037)
>Why invent a new standard?

Because they suck?

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by dvdcxn on Thursday March 23, 2017 @12:09PM (#13941058)
Care to argue why? Also, there are countless alternative languages to compile down to HTML or CSS available. Feel free to create your own if none agree with your personal leanings.
Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by simion314 on Thursday March 23, 2017 @12:32PM (#13941308)
CSS has many weird is corner cases where you have an issue and after a lot of debugging, trying things, getting mad you find on Stack Overflow that you add a ilogical rule like "min-width:0", so css is ok until you end up in a tricky problem where you need to understand how the css code works under the hood to fix. Other issue with css is too big and complicated, good layout modes are added but we stil ahve the old ones and you need to understand everything because most developers work on existing code and you hit all kind of layouts like floating,absolute,relative. Flexbox layout seems better but stil worse then layouts I have seen in MXML and WPF. So ignoring JS that you could replace, getting a new GUI for the Web inspired by MXML/WPF or QML with a sane subset of css would improve the situation.
Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by obsurveyor on Thursday March 23, 2017 @01:22PM (#13941853)
> you add a ilogical rule like "min-width:0"

Yeah, like my favorite of these lately, widows and orphans. Chrome changed a default that affected inline-blocks within columns that caused them to wrap prematurely after version 52 or so. It is especially bad because the other popular browsers don't even support these yet and looked fine.

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by coldtea on Thursday March 23, 2017 @12:48PM (#13941482)
>Care to argue why?

Where do I start?

1) Designed for document presentation, not for apps. 2) Limited widget selection (native forms and that's it). 3) Different implementations between vendors. 4) Bad at layout (20+ years to get to Flex and Grid CSS layout which kind of resembles UI layouts but is still not supported everywhere. 5) Slow 6) Batter hungry 7) Too many un-needed UI layers (DOM over native widgets) 8) Extra language layer (JS on top of v8 on top of native execution) 9) JS is not the best language to write large scale software (to put it mildly) 10) Restricted access/integration to native platform APIs.

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by ksk on Thursday March 23, 2017 @01:00PM (#13941617)
Do you want to listen to the reasons, or just tell them to "go make your own if you don't like it"? You can't have it both ways.

I agree that simply saying X sucks is not a valid argument. Howeever with CSS/HTML the flaws are too numerous and already discussed ad nauseam over the past 15 years. Everytime a new version of CSS comes out, people go and try it and find out that it sucks, whether its th broken box model or the broken float layout techniques or the constant fiddling you are forced to do to get anything working. Every web developer I've seen adopts the 'edit and refresh' trial and error model of developing which is the direct result of a bad spec. Which also explains why there isn't even a reference implementation. As far as UI layout is concerned I am fairly sure I could out-compete a web developer in terms of time taken to implement, using something like IMGUI.

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by pcwalton on Thursday March 23, 2017 @01:11PM (#13941732)
> Which also explains why there isn't even a reference implementation.

As someone who has spent years implementing those standards, a reference implementation would not help me at all.

> As far as UI layout is concerned I am fairly sure I could out-compete a web developer in terms of time taken to implement, using something like IMGUI.

Dear imgui's layout model doesn't scale at all, due to the fact that it's immediate mode. It redoes layout from scratch every frame.

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by coldtea on Thursday March 23, 2017 @04:43PM (#13944074)
>a reference implementation would not help me at all.

Well, considering that the web has been for decades a landmine of subtle rendering differences based on different interpretations of the same standards, it would surely help others...

Also, I'm not sure what you're saying here. That, warts and all, you love the web as a programming platform?

Well, maybe you do.

But then again, you don't program everyday IN it. You program a rendering engine for it in Rust, so you're safely protected from the horrors of web programming.

>Dear imgui's layout model doesn't scale at all, due to the fact that it's immediate mode. It redoes layout from scratch every frame.

Aren't (or at least weren't) most computer games "immediate mode" too, and far more demanding than any web page?

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by wtetzner on Monday April 03, 2017 @02:52PM (#14025880)
> Dear imgui's layout model doesn't scale at all, due to the fact that it's immediate mode. It redoes layout from scratch every frame.

Which isn't a problem if you're layout algorithm is fast/simple. If it's not, then it's a bigger issue.

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by ksk on Thursday March 23, 2017 @02:21PM (#13942537)
>As someone who has spent years implementing those standards, a reference implementation would not help me at all.

I don't quite understand what you meant your comment to be indicative of. That nobody else would consider it useful? That you personally see no value in reference implementations at all?

>Dear imgui's layout model doesn't scale at all, due to the fact that it's immediate mode. It redoes layout from scratch every frame.

Could you detail the UI are you thinking of where IMGUI is inefficient but HTML/CSS isn't? Not asking for a formal spec, just a general usecase..

My problem with CSS/HTML is that productivity scales inversely when using them.

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by vetinari on Thursday March 23, 2017 @12:30PM (#13941288)
There was XUL and it used native widgets.

XUL is dead now, HTML+CSS won.

Re:VS Code uses 13% CPU when idle due to blinking cursor ren... by rimliu on Friday March 24, 2017 @07:37AM (#13948217)

  > everyone understands it and can work immediately with it.
Only if by "understands" you mean "everyone is capable to throw things at the wall and seeing what sticks". I have seen a lot o HTML and CSS and let's just say, only a small fraction looked like it was done by someone with understanding "what" and "why". Otherwise it was just tortured to the point "somehow works unless someone changes something".