AndrewBelt / hack.chat

a minimal, distraction-free chat application
https://hack.chat/
MIT License
2.39k stars 336 forks source link

Using uWebSockets to improve performance #145

Closed iONinja closed 6 years ago

iONinja commented 6 years ago

I haven't tested it, but this should work fine.

AndrewBelt commented 6 years ago

What do you mean "improve performance"? hack.chat isn't resource bound in any way. Also, why would anyone accept an untested PR?

iONinja commented 6 years ago

Maybe you don't need the performance, but uWebSockets delivers better results.

Benchmarks

Haha I'm new to open-source, forgive me. I don't think it needs much testing, because:

uws tries to mimic ws as closely as possible without sacrificing too much performance. In most cases you simply swap require('ws') with require('uws')

Source: uws on NPM

AndrewBelt commented 6 years ago

So what do these "results" mean if they don't mean more performance? It deposits $10 in my bank account when someone logs in? It makes people type faster? It sprays tire sealant on all the unknown security holes? No one to my knowledge has complained about the latency, bandwidth, CPU, RAM, etc of hack.chat, so it makes no sense to seek for a solution to solve a nonexistent problem.

I don't think it needs much testing

Open source software is fun and rewarding to develop, so learning it is definitely a worthwhile endeavor. So my first lesson is that all code is incorrect except for the most trivial bits. It's just a matter of whether you happen to run into those problems in your own use case.

And if performance was a problem, never trust generic benchmarks on product websites. 99.999% of the time, they're solving a different problem with a different environment and different scale. The only true benchmark for your options are ones tested on your own problem or something very similar.