8 ms·
> Tom Tromey and I have replaced the most performance-sensitive portions of the source-map JavaScript Library’s source map parser with Rust code that is compile
by MrBingley 9y ago
> Tom Tromey and I have replaced the most performance-sensitive portions of the source-map JavaScript Library’s source map parser with Rust code that is compiled to WebAssembly. The WebAssembly is up to 5.89 times faster than the JavaScript implementation on realistic benchmarks operating on real world source maps.
Wow. Some people have been wondering if Rust has a "killer app", but this could be it. Right now WebAssembly only supports non-GC languages (so C, C++, and Rust), and of those three Rust is the easiest to get started with. It looks really appealing.
- steveklabnik 9y agoI personally am a huge advocate of this vision. This stuff is a bit hard to get into at the moment, as it's early days, but as things coalesce, we're also working on making everything well documented and super-smooth to use. It's already reasonably easy, but we want it to be trivial.
- vvanders 9y agoYup, allocation and performance are tightly tied for a variety of reasons. Languages like Rust that have a nuanced control over allocation will exceed in spaces like this.
- jjtheblunt 9y agoWhy do you say Rust is easier to start with than C or C++? [Disclaimer : i'm old enough to dream in K&R C and later ANSI C, and then C++, but am more than enthused about Rust, so a genuine question]
- seba_dos1 9y agoI would guess that a language in where the compiler holds your hand so you don't shoot yourself in the foot is probably by definition a bit easier than one that hides traps for you behind corner every now and then :)
- carlmr 9y agoWhile I generally agree with that sentiment, Rust's compiler is so hard to please that a lot of C/C++ developers find it hard to do it. I think for a beginner it's even harder. C is so small a language that you can learn it much quicker. The problems surface later on.
- neikos 9y agoWhat do you mean by 'hard to please'? The joke about the compiler being some beast you need to sacrifice a goat to seems to put the blame on the wrong end of the computer imo. Unless what you are doing is not fit for what guarantees Rust gives you, the compiler should just be a crutch in case you missed a step.
- carlmr 9y agoI thought the same until I actually tried Rust. The compiler will complain in a some places which are ok if you know what's happening. It was probably easier to implement the borrow checker that way. At the same time a lot of the error messages are very cryptic if you haven't seen them before. It is in that sense hard to please. A lot of this might become better with coming iterations though.
- steveklabnik 9y agoNow, this is true in many senses, as it's inherently how static analysis works, but I've also had many experiences where someone joins one of our IRC channels, shows some code and says "hey the borrow checker won't let me do this thing that's totally safe" and then I or someone else replies "well, what about this?" to which the answer is "...... oh. yeah." This is virtually almost always from C++ programmers. It's hard to escape the mindset of languages we're used to! > At the same time a lot of the error messages are very cryptic You should file bugs! We care deeply about the legibility of error messages, and the whole --explain system is there to try and go above and beyond.
- 9y ago
- tcoff91 9y agoPerhaps he means the tooling for using emscripten with rust is superior, and easier to get set-up? (i'm not actually sure if it is, i've never tried it). I'm really excited about the future of rust and have really enjoyed writing a raytracer in it, but I don't see how it's an easier-to-use language than C or C++. Easier to write safe code in sure, but not easier to pick up for a newbie.
- bluejekyll 9y ago> the tooling for using emscripten with rust is superior emscripten is no longer required for Rust to target WASM. There is a new target of wasm32-unknown-unknown. This project gives you quick bootstrap instructions into WASM with Rust: https://github.com/koute/stdweb https://github.com/koute/stdweb Very quick to get started with, and the examples get you going quickly. I just used it yesterday (nothing fancy), and everything worked right out of the box.
- deleted 9y ago[deleted]
- mden 9y agoMaybe it's not easier to start depending on languages you are familiar with, but I think after the starting phase it gets easier by having standard libraries for common things like hashmaps, by having a much easier to configure build system, and by having a very solid package manager. Longer term into a project the actual language's features remove a lot of C or C++ snafus you can run into, though in fairness they also make certain common patterns obsolete which can be very frustrating until you get used to them.