Live data from Hacker News

Building a hackable editor in the browser

bjenik.com

71–74 of 74 posts

Re: Building a hackable editor in the browser

#71
post #23

Earlier quoted context omitted.

> If you think you browser is fast, you'd be blown away by any decent application. In data centers, loading data from networked server, where it's in memory, can be used over loading data from a disk, because disk is comparatively slow. A web app can load JavaScript assembler, which isn't much slower than a desktop app written in C. Bigger - and slower - parts of the web app can be loaded after the app starts interac…

> In data centers, loading data from networked server, where it's in memory, can be used over loading data from a disk, because disk is comparatively slow. RDMA has no relevance to this discussion. > A web app can load JavaScript assembler, which isn't much slower than a desktop app written in C. This is incredibly wrong. An Electron app goes through many stages before code is executing with acceptable performance: 1…

> At #5, you have code that is as fast as it gets. It is nowhere near as fast as native code (any benchmarks you think of are synthetic and designed to show JavaScript as fast—it doesn't take a lot to shake out the issues).

This. And to make matters worse, a lot of benchmarks start with something like, "To be fair to , let's cripple by implementing the programs using the paradigm favored by ." If you want the real results, have an expert in each language implement the spec without looking at the other program.

Someone mentioned Photoshop being slow compared to Slack/VSCode. That is Apples to Oranges comparison if I ever saw one.

> And the disadvantage is that they are are huge, resource intensive and pathetically slow.

And don't work natively on any platform. You essentially program for the lowest common denominator and do not take advantage of any of the features provided by the platform -- especially accessibility. For example: Zoom In on any half-way decent editor increases the text size. Zoom In on VSCode (macOS) blows up the entire UI -- leaving little space for actual text. This is just one example -- I can line up many more.

Re: Building a hackable editor in the browser

#72
post #10
post #9

Earlier quoted context omitted.

Probably because your desktop apps are bloated, too. Any software that needs longer than zero point two seconds reacting to user action (this includes starting the program) should be improved upon.

I think the only native apps that I use are Steam, Unity, Photoshop, SourceTree and VSCode. Out of those the only "fast" one is VSCode, which is actually written in JS. Even though you mentioned the browsers being "bloated", for me Chrome always starts up instantly and I have no responsivness issues when browsing sites, playing browser games or using browser apps.

Do you really want to compare Photoshop with VSCode?

Re: Building a hackable editor in the browser

#73
post #65

Earlier quoted context omitted.

> and perhaps hopefully become a "standard" API people can target on Linux without having to carry 29892482923TB of libraries for a trivial app since you cannot rely on anything outside of X11 being there so, uh, what would you depend on ? at the bare minimum you would need, for a gui toolkit : - dependencies to X11 (xcb) and wayland (and cocoa and win32) - dependencies to xkb, etc.. for keyboard handling - dependenc…

Of everything that list all you really need is the X libraries and you do not need to carry (meaning distribute) those since they are part of the every single desktop environment and have a stable ABI. The rest aren't strictly necessary, but i think Cairo has a stable ABI. I'm not sure if it is available everywhere though. OpenGL (and Vulkan) can be provided via dynamic linking, though only via an API that doesn't gu…

> Of everything that list all you really need is the X libraries and you do not need to carry (meaning distribute) those since they are part of the every single desktop environment and have a stable ABI.

both Debian and Fedora use wayland by default now. And wayland alone only gives you the ability to open a viewport, so you are going to need a lot of stuff if you want your UI library to do something as simple as :

    #include 
    int main() {
        linux_window* window = linux_ui_create_window();
        linux_widget* label = linux_ui_create_label(u8"お早う御座います");
        linux_ui_widget_set_parent(label, window);
        linux_ui_widget_set_pos(label, 50, 50);

        return linux_ui_process_events();
    }
> Note that this is in the context of making that API a standard people can target, not a reusable library (and its own dependencies) people carry with their binaries. Basically the equivalent of how you do not need to give USER32.DLL on Windows to your users because you can pretty much expect that it will be there.

But almost no one makes Win32 apps with the Win32 API anymore anyways. The majority of desktop windows apps created today are using WPF or UWP which does not use any "native" stuff (that is, the win32 UI API), Qt or Electron. If this model does not even work on windows, why would you want to port it on linux instead of letting people ship their app as they wish ?

> Nowadays the only equivalent on Linux is the X libraries, anything else is either not guaranteed to be there now, or not guaranteed to be there in ~5 years because thanks to CADT people cannot stick with an API and feel the need to break everyone's programs to feel useful.

Even if someone made this magical new library today, I would still have to package it along with all its dependencies in an AppImage because I have users still on ubuntu 12.04, 14.04, and 16.04 as well as debian stretch and jessie.

Re: Building a hackable editor in the browser

#74
post #32
post #23

Earlier quoted context omitted.

> If you think you browser is fast, you'd be blown away by any decent application. In data centers, loading data from networked server, where it's in memory, can be used over loading data from a disk, because disk is comparatively slow. A web app can load JavaScript assembler, which isn't much slower than a desktop app written in C. Bigger - and slower - parts of the web app can be loaded after the app starts interac…

This is misleading as all get-out. "JavaScript assembler" is WASM, I assume? Running it in a browser still includes the overhead of a browser. The slowness is not from the wasm runtime (which has been implemented standalone and is fast), but in the browser-y gui stuff (which is what electron is good for). Also, WASM has less tooling etc. around it than JS, so JS is used for now. And jS is slow, but it's what is used…

> The slowness is not from the wasm runtime (which has been implemented standalone and is fast), but in the browser-y gui stuff

Not entirely true: In representative benchmarks, WASM has only 65% of the performance of native code. Of course, everything gets much worse the moment you interact with browser mechanics—WASM is only this fast while doing raw computations.

https://www.usenix.org/conference/atc19/presentation/jangda

Post reply on HN