Live data from Hacker News

Writing a website in Rust

blog.viraptor.info

101–110 of 141 posts

Re: Writing a website in Rust

#101

Well, IMHO, "the right hammer for the right nail". Rust is a great systems language (besides the lack of bitfields) but I wouldn't use it as a web language. Just as much as I wouldn't use C++ to develop webapps. Sure you can do it but then again there are far easier ways to achieve your goal.

Plenty of people use C++ for web apps. It doesn't take a good coder a lot of time to use them. Those apps also run crazy fast compared to Python apps, even on embedded boards. Plus they support every security, speed, or reliability-enhancing tech ever developed for native code.

So, I'd rather use a higher-level language (and do) for most web-application development. I also love Python for its tradeoffs, esp productivity & readability. Yet, there are valid use-cases for native web apps esp where performance or memory-usage matters.

Re: Writing a website in Rust

#102
Interesting project. If Rust is to replace C++, then we need to see it exercised in all domains C++ has succeeded in. As I told another commenter, C++ with good frameworks does very well in web applications albeit with fewer libraries & utilities. A team of Rust programmers could catch Rust up to one of the C++ web frameworks and do a shootout between the two on realistic web apps. The results in terms of efficiency, productivity, and maintainability for each should tell us plenty about Rust's success in terms of its objectives.

That experiment among others, of course.

Re: Writing a website in Rust

#103
post #91

Earlier quoted context omitted.

Some would say Scala is not a "web language" either, but I think Play Framework developers would disagree. The rules of the game are not as clear as they used to be. For instance - web frontend is being dominated by JS frameworks and all the backend does is handling REST calls. I would argue that when you need scalability/performance/reliability, when milliseconds start to count - static languages make very much sens…

This may miss your point, but I would easily argue that Scala is a "web language," just as Java is and was before it. Scala's focus on concurrency helps drive this point, as it's not response time so much as throughout given IO constraints that make a good environment for web applications.

Yeah, I don't really think people would argue scala doesn't make sense for web dev. I think the main is that webdev can generally tolerate GC and it's not worth giving it up.

Re: Writing a website in Rust

#105
post #96

The tooling for the web written in JavaScript is excellent, so I was curious, are there any options there are for calling JavaScript from Rust code? I know there is the ffi module for NodeJS that allows you to call Rust from JavaScript, but I was wondering if there is something that works well in the other direction.

I once experimented this, and it worked. I wanted to do this because I needed a decent and fast CommonMark library, but Rust didn't have one. (Yes, I tried to embed JavaScript in Rust just to parse some MarkDown text!) There are two libraries that embed V8 in Rust, but all of them seem to be abandoned for now. However if there become enough interests, a new project will arise I think. (FWIW, I ended up calling Common…

You know there's a CommonMark reference implementation in C, right?

https://github.com/jgm/cmark

I haven't tried it, but I would expect it would be easier to link with Rust than an entire other language VM.

Re: Writing a website in Rust

#106

Earlier quoted context omitted.

If you're going to write a block of text like that, you could at least fact check the main premise. Rust had GC. They started off with GC, so it wasn't the very first decision that "no code can perform with garbage collection". Here's a post about removing GC from core rust 2 years ago: http://pcwalton.github.io/blog/2013/06/02/removing-garbage-c... Next: they didn't kill GC. They removed it from core, because rust i…

Rc and Arc aren't exactly GC types... they are just reference-counted pointers, Rc being akin to C++'s shared_ptr. I get that in a sense, this is garbage collection, but certainly not full-featured like the ones you find in other languages.

Actually, std::shared_ptr is more like Rusts Arc type, because std::shared_ptr is atomic, and Rusts Rc is not.

Re: Writing a website in Rust

#107
post #96

Earlier quoted context omitted.

I once experimented this, and it worked. I wanted to do this because I needed a decent and fast CommonMark library, but Rust didn't have one. (Yes, I tried to embed JavaScript in Rust just to parse some MarkDown text!) There are two libraries that embed V8 in Rust, but all of them seem to be abandoned for now. However if there become enough interests, a new project will arise I think. (FWIW, I ended up calling Common…

You know there's a CommonMark reference implementation in C, right? https://github.com/jgm/cmark I haven't tried it, but I would expect it would be easier to link with Rust than an entire other language VM.

Oh, yes. I had also tried that, but found some convenient features missing, e.g. line breaks treated as `
` (not two consecutive blank lines), GitHub-flavored tables, and the strikethrough syntax. I'll have to wait until the official CommonMark spec includes them.

Also the third-party CommonMark libraries are usually easier to extend, with your own syntax addition.

Re: Writing a website in Rust

#108
post #53

Earlier quoted context omitted.

We've been focused more on language semantics than the Benchmarks Game for a while now. A few months ago, iirc, we were faster than C on some of them.

It looks like the worst offenders (vs C) are regex-dna (which is a young regex + unicode vs pcre + ascii) and fasta (where the rust version is still single-core). The others are at 1-2x cpu and on par for memory. I suspect most of them could be on par or better with a little effort - only regex looks hard.

> only regex looks hard.

I'm working on improving the regex engine now. Hopefully I can submit some improvements soon. :-) It will be hard to get near the top, but I think there's some low hanging fruit I can tackle first.

Re: Writing a website in Rust

#109
post #97

Earlier quoted context omitted.

Servo layout, painting, DOM performance. JSON serialization in serde.

Obviously not in any way an answer to the question asked. edit: Please provide a better response than downmods.

Go actually check the things pcwalton mentioned instead of complaining.
Post reply on HN