DEV Community

Andrés Montoya
Andrés Montoya

Posted on

1

Do you use web assembly? Help me with this 🐙

Hi everyone, I have a question about web assembly (I don't know if someone here use it), the thing is that, why this technology has its own variations in other languages? I mean, I can write web assembly code in Python, Java, JavaScript, c#, rust, etc... But this affect the result? If I write my code in Python, will affect the performance if I write the same in rust? Or the output in both would be the same? I'm asking this because I have one idea, which is, all the heavy code that my server needs to be care, I can write in web assembly and the front end does the heavy stuff. Like for example, if I want to rotate an image and then add it some colors, instead of using a lambda function or whatever that needs a server, I can use this awesome front-end technology! What do you think? Thanks!

Sentry blog image

How to reduce TTFB

In the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.

In this article, we’ll see how we can identify what makes our TTFB high so we can fix it.

Read more

Top comments (2)

Collapse
 
oliverjumpertz profile image
Oliver Jumpertz

Hey, cool that you are interested in WebAssembly! I'll try to explain some basics as good as possible. :-)
WebAssembly is a binary format, just like Java or Python has its byte code which is the thing that is actually run by the respective runtimes. (You can read more about it here: webassembly.org/)
The idea is to put something on JavaScript's side which can better be targeted by high-level languages like C/C++, Java, C# or, as you mentioned, Rust or Python and can also be used from JavaScript (like Python has a great native Interface and which is one of the reasons it got so popular beside its elegance and simplicity) easily. Some nice side effects are that it is also really fast and brings more speed to the web.
To target WebAssembly you will most likely need an alternative compiler or a plugin for your language of choice to target WebAssembly. That will also affect the resulting byte code, so yea, output may vary. BUT: It is more important to use a language you are actually capable of or like working with than worrying about performance. The differences will not be so huge that the choice actually matters, at least for a small project.
For a larger project, the quality and performance of the resulting code and also the file size may be more important but I would only start wrapping my head around that when it's time and become necessary.

Collapse
 
andresmontoyain profile image
Andrés Montoya

Thank you so much for your long response!☕🎉

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay