# TypeScript as fast as Rust: TypeScript++

**URL:** <https://forum.devtalk.com/t/typescript-as-fast-as-rust-typescript/49259>\
**Category:** Backend In The News\
**Tags:** rust, in-the-news, typescript\
**Created:** [9 April 2022 12:43 UTC](https://forum.devtalk.com/t/typescript-as-fast-as-rust-typescript/49259 "2022-04-09T12:43:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CommunityNews](https://forum.devtalk.com/user_avatar/forum.devtalk.com/communitynews/32/1113_2.png) [@CommunityNews](https://forum.devtalk.com/u/CommunityNews)\
**Post date:** [9 April 2022 12:43 UTC](https://forum.devtalk.com/t/typescript-as-fast-as-rust-typescript/49259/1 "2022-04-09T12:43:30Z")

</div>

> _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:
> 
> ```auto
> // 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;
> }
> 
> ```
> 
> ```auto
> // 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](https://zaplib.com/docs/blog_ts++.html)

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