Thanks for submitting the form.
Introduction to Wasm
Wasm, officially called Web-Assembly, is an Optimized code format and API for the web. It can significantly enhance the performance of websites. Its version 1.0 was released in 2017 and has become an official W3C standard. Its support has quickly spread to all the major browser systems for use cases like in-browser: video editing, 3D games, VR and augmented reality, P2P services, simulations, and more.
Wasm is not only limited to use with browsers but is being used in mobile and edge-based environments for performance enhancements.
An application programming interface API Testing attempts to connect an application to the web and different APIs. Click to explore about, API Testing Tools and Best Practises
Why is Benchmarking important?
- Instead,.wasm files can be checked and assembled in a single pass, allowing for "Streaming Compilation": a browser can begin compiling and executing them as soon as it downloads them, precisely like streaming movies.
- Points like these make it a very interesting topic for having a practical example to see which one is better and by how much.
- There has been a lot of benchmarking done by various parties in this regard, and have produced some remarkable results.
- There has been a lot of benchmarking to evaluate how well wasm works. Consider the benchmarking of the K-means clustering algorithm.
- k-means clustering is a vector quantization method that seeks to partition n observations into k clusters. Each observation belongs to the cluster with the nearest mean (cluster centres or cluster centroid), which serves as the cluster's prototype.
- As evident, with an increase in the k value (iterations), the performance of wasm proves to be better (4X than the JS counterpart).
API proxies decouple the app-facing API from your backend services, shielding those apps from backend code changes. Click to explore about, Understanding APIs and API proxies
Main points to keep in mind :
- Keep it simple
- Use as many standard modules as possible to make it equivalent.
- Have similar implementations
- Benchmark on the same criteria
So, we begin by choosing an Algorithm to use for computation in our application. I have decided on the Quicksort algorithm.
Here is a look at the interface. Here the process is simple :
- Drag/Drop or select a CSV dataset (samples are provided alongside for download).
- Start the processing using the Event.
- Process 2 : QuickSort the array of data.
- Process 3 : visualize the sorted data onto the page.
At this point, we will have multiple parameters calculated during the execution of the processes (parallel).
A good API makes it easy to improve the system by providing building blocks. Click to explore about, API Development Best Practices
What are the benchmarking outcomes during the test ?
Below are the benchmarks obtained during the testing :
Looking at these benchmarks, I was shocked but in a happy way. Happy to see what a great improvement WebAssembly has to offer to the Web world.
Use Cases of Wasm
WebAssembly has a vast variety of use cases with the ability to boost performances in all domains accessible.
Some possible uses of WebAssembly are :
- Inside the browser
- Better execution speeds for existing toolkits and language on the web (C/C++, Rust, Go, etc.)
- Image/video editing
- High-end gaming
- CAD application
- Virtual Reality
- Local web Server
- Fat clients for enterprise applications (e.g ., DataBases)
- Remote Desktop
- Outside the browser
- Main-frame in web-assembly but UI in Js
- Reusing existing code by targeting WebAssembly
- Discover more about API’s Latency Rate vs Response Rate
- Read here about KrakenD API Gateway for Microservices