News for hackers. Stuff that matters.
Re:HyperTerm – JS/HTML/CSS Terminal by michaelmior on Friday July 15, 2016 @01:10PM (#12102414)
I'm curious why there's so much node/electron negativity circulating. (Although I guess asking for positivity when it comes to electron is a bit of a stretch :P)
Re:HyperTerm – JS/HTML/CSS Terminal by jackmott on Friday July 15, 2016 @03:39PM (#12103314)
Well for instance, Atom and VSCode have ~50ms (or ~49x) more input latency than editors written in C (source: https://pavelfatin.com/typing-with-pleasure/ )

But maybe we are willing to accept 50x worse performance and higher memory requirements and slower startup time because the language is nice and guarantees correctness....Well no, it is javascript, not Haskell or Lisp. So, what is the win here? Why have we collectively decided javascript is a good tool for making applications for the desktop?

Re:HyperTerm – JS/HTML/CSS Terminal by codemonkeymike on Friday July 15, 2016 @03:57PM (#12103423)
I can't agree more, There is no reason that editing text files would need a full web browser which is buggy and slow. Many of these javascript apps which are replacing native apps use 500mb of ram, at some point you will have 5-10 of these things churning memory and consuming battery life and cpu cycles. (Note Atom, HyperTerm, Chrome, Slack, and Kitematic is already 5 browser apps)
Re:HyperTerm – JS/HTML/CSS Terminal by johnfn on Friday July 15, 2016 @07:15PM (#12104397)
* We've decided to use JavaScript because the community is there. Go ahead and write an IDE in Haskell - have fun rewriting all the libraries that already exist in JavaScript and soliciting for open source contributions when a tiny fraction of all programmers can understand it.

I love Haskell and lisp, but you have to face the facts.

* TypeScript is actually a good language, and gives pretty darn good correctness guarantees.

* Your benchmark does not test against VSCode, which is much faster than Atom.

Re:HyperTerm – JS/HTML/CSS Terminal by stymaar on Saturday July 16, 2016 @04:23AM (#12105671)
> * TypeScript is actually a good language, and gives pretty darn good correctness guarantees.

TypeScript's main focus is IDE tooling, not correctness. Here is an example on how generics are unsound in TypeScript: http://djcordhose.github.io/flow-vs-typescript/2016_hhjs.htm...

If you want to write JavaScript with a type system focused on soundness, you should give [flow](https://flowtype.org/) a try.

Re:HyperTerm – JS/HTML/CSS Terminal by johnfn on Saturday July 16, 2016 @01:42PM (#12107165)
I don't think that anyone argued TypeScript is 100% sound, nor is that a meaningful goal to hit. I find TS to be a solid language that gives me reasonable confidence in my code. (The tooling is also great!)
Re:HyperTerm – JS/HTML/CSS Terminal by Azkar on Friday July 15, 2016 @03:43PM (#12103341)
Well now when someone removes left pad from npm your whole terminal can break.
Re:HyperTerm – JS/HTML/CSS Terminal by joshmanders on Saturday July 16, 2016 @11:22AM (#12106632)
No it can't. After that whole fiasco npm has made it so packages once published cannot be removed after a 24 hour window without npm manually doing it on your behalf, that is to make sure this instance never does happen again.
Re:HyperTerm – JS/HTML/CSS Terminal by random28345 on Friday July 15, 2016 @01:36PM (#12102591)
> I'm curious why there's so much node/electron negativity circulating.

"There are only two kinds of languages: the ones people complain about and the ones nobody uses".

--Bjarne Stroustrup

I'm pretty sure that applies to language runtimes as well.

> Although I guess asking for positivity when it comes to electron is a bit of a stretch

I like to stay current, and in this charged environment, I'd be shocked if anode runtime wasn't at the nucleus of every accelerator.

I'm sure Dijkstra is half-spinning in his grave.

Re:HyperTerm – JS/HTML/CSS Terminal by pbiggar on Friday July 15, 2016 @10:36PM (#12104999)
Your puns are glorious!
Re:HyperTerm – JS/HTML/CSS Terminal by sehr on Friday July 15, 2016 @01:27PM (#12102534)
They're slow, big, and outrageously inefficient. Most electron apps also come with this weird web influenced "I'm kinda native y'all trust me" UI design which makes it even worse. My battery and eyes simply can't stand the things.
Re:HyperTerm – JS/HTML/CSS Terminal by michaelmior on Friday July 15, 2016 @02:02PM (#12102754)
Interesting. I haven't experienced the slowness of Electron apps. And outrageously inefficient doesn't really matter to me if it's efficient enough for me not to notice any slowdown.
Re:HyperTerm – JS/HTML/CSS Terminal by jackmott on Friday July 15, 2016 @03:45PM (#12103355)
But if we are going to accept the computational inefficiency, what do we gain for it?

If our only answer, collectively, as developers, is the richness of the ecosystem, then perhaps we should be moving our time and energies to make a rich ecosystem in either a language/runtime environment that performs better (C/Rust/OCaml/Whatever) or one that encourages correctness and/or speed of development.

I know some people think javascript is the latter, and I can't prove them wrong, but I suspect that is not true.

Re:HyperTerm – JS/HTML/CSS Terminal by nojvek on Sunday July 17, 2016 @09:24PM (#12112758)
Electron means your app runs on Mac + Win + Linux without much effort. It could also potentially run on the web browser.

That is a huge sell.

Re:HyperTerm – JS/HTML/CSS Terminal by elmigranto on Friday July 15, 2016 @03:19PM (#12103211)
I think he meant inefficient in terms of battery power.
Re:HyperTerm – JS/HTML/CSS Terminal by ank_the_elder on Monday July 18, 2016 @01:24AM (#12113356)
I have tried to edit a file with a little bit of long JSON that came from a server (less than 50K) and atom completely froze trying to display it. This was two weeks ago. I've ditched Atom entirely.
Re:HyperTerm – JS/HTML/CSS Terminal by teamhappy on Friday July 15, 2016 @01:24PM (#12102509)
Trivial apps depending on 14+ million lines of code is not a good thing.

Edit: @michaelmior I think you know what I mean.

Re:HyperTerm – JS/HTML/CSS Terminal by michaelmior on Friday July 15, 2016 @01:26PM (#12102527)
I think a good terminal emulator is far from trivial.

Edit: I'm not sure I do know what you mean. I agree that building trivial apps in Electron probably doesn't make sense. But my terminal emulator is something I spend most of my day using. If building that on top of 14 million lines of C++ gives me a better piece of software, I'm all for it.

Re:HyperTerm – JS/HTML/CSS Terminal by Jtsummers on Friday July 15, 2016 @01:49PM (#12102679)
https://www.openhub.net/p/putty

Perhaps not as feature comlpete, and not my daily use terminal emulator, but it's only 110k lines of code. And it's not just a terminal emulator, that's just one thing it does in that 110k lines of code.

EDIT: I was going to look up others but I'm distracted by other obligations. My point being: Terminal Emulators aren't actually that complex.

Re:HyperTerm – JS/HTML/CSS Terminal by destructionator on Friday July 15, 2016 @07:10PM (#12104374)
I wrote a terminal emulator <https://github.com/adamdruppe/terminal-emulator> and use it daily so it is good enough for me at least... clocks in at ~15k lines (including the gui helper lib).

The biggest complexity is dealing with legacy terminals... and you can really just target the handful of xterm features programs actually use and get something working without a huge amount of code.

Re:HyperTerm – JS/HTML/CSS Terminal by alaroldai on Friday July 15, 2016 @01:53PM (#12102704)
Does it though? iTerm2 is the most feature-rich terminal I've ever used, and even then it's several orders of magnitude smaller then Electron (cloc says it's around 111K lines of Objective-C, with around 38K more lines split across Python and C++).
Re:HyperTerm – JS/HTML/CSS Terminal by michaelmior on Friday July 15, 2016 @02:05PM (#12102771)
Maybe it's not better. That wasn't really my point though. I'm just saying that LOC is a fairly useless metric for evaluating software. Especially from an end user perspective.
Re:HyperTerm – JS/HTML/CSS Terminal by tomc1985 on Friday July 15, 2016 @11:19PM (#12105096)
How so? It affects load time, understandability, binary size, dependency payload...

I personally hate the load times. Node apps always seem to need to think for a second or too. Sublime Text v VSCode is pretty bad. Sublime Text v Atom is even worse.

When you're moving fast and in your flow, it gets to be really annoying.

Re:HyperTerm – JS/HTML/CSS Terminal by michaelmior on Saturday July 16, 2016 @01:13AM (#12105323)
I was talking more about how it affects end users. Understandability of the code and dependencies are irrelevant in this case. Load time is important, but LOC is only a proxy for that metric. It's not totally unreasonable to imagine a well-written app with twice the code start faster than a poorly written one.
Re:HyperTerm – JS/HTML/CSS Terminal by themartorana on Friday July 15, 2016 @02:38PM (#12102953)
I agree with you, with regards to the end user caring or not, but there aren't many tech-unsavvy people using terminal emulators on the regular. So when Putty and iTerm2 both weigh in between 100-200k LOC and this is in the 14m LOC space, it's difficult to not make the presumption that that's a lot for a terminal emulator.
Re:HyperTerm – JS/HTML/CSS Terminal by teamhappy on Friday July 15, 2016 @03:21PM (#12103225)
> I'm just saying that LOC is a fairly useless metric for evaluating software.

That's just not true.

Most open-source people want to be able to read, audit, fix, and (if it comes to it) maintain other people's code. 14+ million lines of code make this virtually impossible. (To be fair: Electron-based apps aren't the best example for the point I'm trying to make.)

Rate of change is another very useful metric.

Re:HyperTerm – JS/HTML/CSS Terminal by e12e on Saturday July 16, 2016 @12:39AM (#12105263)

  git clone git://git.suckless.org/st
  cloc --quiet st
  http://cloc.sourceforge.net v 1.60
  T=0.09s
  (45.8 files/s, 56588.2 lines/s)
  ------------------------------------
  Language   files blank comment code
  ------------------------------------
  C            1      497  253    3654
  C/C++ Header 2       40  124     313
  make         1       13    2      45
  ------------------------------------
  SUM:         4      550  379    4012
  ------------------------------------
[ed: Actually, this get even more extreme for the terminal I actually use everyday, sakura[1]:

  apt-get source sakura
  (cloc sakura)
Gives a total of 2490 lines of code, of which 2380 are C, the rest is CMake, make and Bourne Shell... that is cheating of course, as sakura uses libvte: which clocks in at ~45K lines of C - and a total of ~103K loc all together. Still a far cry from millions of lines of code...

[1] https://bugs.launchpad.net/sakura ]

Re:HyperTerm – JS/HTML/CSS Terminal by michaelmior on Saturday July 16, 2016 @01:02AM (#12105305)
Sure. I wasn't arguing that millions of lines of code are necessary for a terminal. Thanks for the pointer to Sakura though! I quite like it and I might have to give it a try :)
Re:HyperTerm – JS/HTML/CSS Terminal by sgrove on Friday July 15, 2016 @01:36PM (#12102590)
I agree, but I'd take it a step further - the 15+ million Lo(memory-unsafe!)C for the unix kernel other (all?) trivial apps sits on is also not a good thing.
Re:HyperTerm – JS/HTML/CSS Terminal by teamhappy on Friday July 15, 2016 @01:49PM (#12102683)
I agree with your larger point (I think) but for what it's worth: Most of those 15+ million lines are drivers you don't use.
Re:HyperTerm – JS/HTML/CSS Terminal by jahewson on Friday July 15, 2016 @01:32PM (#12102571)
How many lines is the JDK? or .NET, or libcpp?
Re:HyperTerm – JS/HTML/CSS Terminal by teamhappy on Friday July 15, 2016 @01:46PM (#12102665)
LLVM: 1.5 million (I assume libc++ is less than 500k)

OpenJDK: 6.8 million

.NET: 10.5 million

Source: https://www.openhub.net/

Re:HyperTerm – JS/HTML/CSS Terminal by Zolomon on Friday July 15, 2016 @01:25PM (#12102518)
I believe it has to do with the amount of performance lost in the overhead with the electron stack versus a native implementation.

Please correct me if I'm wrong.

Re:HyperTerm – JS/HTML/CSS Terminal by michaelmior on Friday July 15, 2016 @01:30PM (#12102556)
For the majority of applications, I'd imagine there's a negligible performance difference. Besides, any app built on Electron will run infinitely faster than one which wasn't built at all since the developer didn't want to learn another language. I'm not saying Electron is suitable for everything, but I think it has its place.
Re:HyperTerm – JS/HTML/CSS Terminal by asdf1234 on Friday July 15, 2016 @02:03PM (#12102762)
> negligible performance difference

Using Atom or VS Code instead of Emacs cuts my battery life by a few hours. The Spotify desktop app that uses a ton of JavaScript is also horribly inefficient and has a big impact on battery life.

None of this is negligible.

Re:HyperTerm – JS/HTML/CSS Terminal by klibertp on Saturday July 16, 2016 @12:57PM (#12106976)
On the other hand, my Emacs starts up in more than thirty seconds. To fully start up it needs to read some 2k loc of my own ELisp code and hundreds of thousands loc of required libraries.

I use Emacs as a Jabber client, Python and Clojure development environments, file manager, image and pdf viewer, HTTP server, spreadsheet and note-taking app and (polyglot) Literate Programming environment. And that's just the beginning of what it can be used for.

In other words, giving Emacs as an example of small and fast, natively written application is a bit unfortunate. Not to mention most of Emacs is written in ELisp, so the "natively" part is not even factually correct.

Re:HyperTerm – JS/HTML/CSS Terminal by mitchty on Friday July 15, 2016 @02:54PM (#12103066)
On top of this, chrome/chromium versus safari is another 1-2 hours of battery. I think people vastly underestimate the energy requirements of web technologies.
Re:HyperTerm – JS/HTML/CSS Terminal by woah on Friday July 15, 2016 @10:05PM (#12104910)
On which OS?
Re:HyperTerm – JS/HTML/CSS Terminal by city41 on Friday July 15, 2016 @01:52PM (#12102692)
I still question Electron for "commercial quality" apps. The Electron runtime by itself is about 100mb. I've built an internal Electron app for work and for that it's absolutely fantastic.
Re:HyperTerm – JS/HTML/CSS Terminal by mej10 on Friday July 15, 2016 @01:22PM (#12102501)
There are more and more applications based on it -- negativity increases along with popularity.