CommunityNews

CommunityNews

TypeScript as fast as Rust: TypeScript++

TL;DR: This is a proposal to create a language that sits somewhere between Typescript and Rust, and which you can incrementally adopt if you already use Typescript.

Typescript and Rust can feel pretty similar:

// Typescript
type Vec2 = { x: number, y: number };

function avgLen(vecs: Vec2[]): number {
    let total = 0;
    for (const vec of vecs) {
        total += Math.sqrt(vec.x*vec.x + vec.y*vec.y);
    }
    return total / vecs.length;
}
// Rust
struct Vec2 { x: f64, y: f64 }

fn avg_len(vecs: &[Vec2]) -> f64 {
    let mut total = 0.0;
    for vec in vecs {
        total += (vec.x*vec.x + vec.y*vec.y).sqrt();
    }
    return total / vecs.len() as f64;
}

In some ways, Rust feels like a more restrictive but faster version of Typescript. But Typescript/Javascript can be very fast too; owing to years of hard work by browser vendors. In this article we’ll look at the performance characteristics of each in more detail, and see if we can have the best of both worlds.

Read in full here:

https://zaplib.com/docs/blog_ts++.html

This thread was posted by one of our members via one of our news source trackers.

0 882 0

Where Next?

Popular Backend topics Top

First poster: AstonJ
Wren is a small, fast, class-based concurrent scripting language. Think Smalltalk in a Lua-sized package with a dash of Erlang and wrapp...
3 967 1
New
New
First poster: bot
As I continue to work on Cyberscore, I keep finding new quirks / features in PHP and MySQL. All of the tests below are being run on mysql...
0 1195 0
New
First poster: bot
FreeBSD allows the management of multiple instances of PostgreSQL by means of rc.conf(5) . The trick is to use profiles , that are avail...
0 1039 0
New
CommunityNews
Tails is a minimal, fast Forth-like interpreter core. It uses no assembly code, only C++, but an elegant tail-recursion technique inspire...
5 1543 1
New
First poster: bot
C++ Programming - The State of Developer Ecosystem in 2021 Infographic. The State of Developer Ecosystem 2021 is a detailed report about...
0 1059 0
New
First poster: bot
TLDR; the future of ML is Julia. If you are looking for a quick answer, there you have it. If you want the well reasoned explanation, sti...
0 1110 0
New
First poster: bot
For the first 8 or so years of my programming experience, while I was an undergraduate and later graduate student, working in the experim...
2 1339 0
New
CommunityNews
Martin Thompson On How To Manage Software Complexity | The Engineering Room Ep. 4. In this episode, Dave Farley chats with Martin Thomps...
7 1276 1
New
CommunityNews
Letting Go of Random. In a recent post I shared some thoughts about art and included a few, somewhat tongue-in-cheek comments about the ...
/go
5 1006 1
New

Other popular topics Top

Devtalk
Hello Devtalk World! Please let us know a little about who you are and where you’re from :nerd_face:
476 5728 111
New
Exadra37
On modern versions of macOS, you simply can’t power on your computer, launch a text editor or eBook reader, and write or read, without a ...
24 3679 24
New
Rainer
Not sure if following fits exactly this thread, or if we should have a hobby thread… For many years I’m designing and building model air...
200 3586 78
New
dimitarvp
Small essay with thoughts on macOS vs. Linux: I know @Exadra37 is just waiting around the corner to scream at me “I TOLD YOU SO!!!” but I...
166 7775 69
New
DevotionGeo
The V Programming Language Simple language for building maintainable programs V is already mentioned couple of times in the forum, but I...
21 11128 7
New
foxtrottwist
A few weeks ago I started using Warp a terminal written in rust. Though in it’s current state of development there are a few caveats (tab...
52 4894 22
New
AstonJ
If you get Can't find emacs in your PATH when trying to install Doom Emacs on your Mac you… just… need to install Emacs first! :lol: bre...
4 4891 0
New
AstonJ
Was just curious to see if any were around, found this one: I got 51/100: Not sure if it was meant to buy I am sure at times the b...
4 3745 1
New
First poster: bot
The overengineered Solution to my Pigeon Problem. TL;DR: I built a wifi-equipped water gun to shoot the pigeons on my balcony, controlle...
0 4367 0
New
PragmaticBookshelf
Author Spotlight: Bruce Tate @redrapids Programming languages always emerge out of need, and if that’s not always true, they’re defin...
54 4591 23
New