Skip to main content
QUICK REVIEW

[Paper Review] The Need for Speed of AI Applications: Performance Comparison of Native vs. Browser-based Algorithm Implementations

Bernd Malle, Nicola Giuliani|arXiv (Cornell University)|Feb 11, 2018
Parallel Computing and Optimization TechniquesComputer Science13 references4 citations
TL;DR

This paper evaluates the performance of AI algorithm implementations across native code, JavaScript, ASM.js, and WebAssembly (WASM) in browser environments. It finds that WebAssembly often outperforms native binaries due to advanced VM optimizations, challenging assumptions about native execution superiority in client-side computing.

ABSTRACT

AI applications pose increasing demands on performance, so it is not surprising that the era of client-side distributed software is becoming important. On top of many AI applications already using mobile hardware, and even browsers for computationally demanding AI applications, we are already witnessing the emergence of client-side (federated) machine learning algorithms, driven by the interests of large corporations and startups alike. Apart from mathematical and algorithmic concerns, this trend especially demands new levels of computational efficiency from client environments. Consequently, this paper deals with the question of state-of-the-art performance by presenting a comparison study between native code and different browser-based implementations: JavaScript, ASM.js as well as WebAssembly on a representative mix of algorithms. Our results show that current efforts in runtime optimization push the boundaries well towards (and even beyond) native binary performance. We analyze the results obtained and speculate on the reasons behind some surprises, rounding the paper off by outlining future possibilities as well as some of our own research efforts.

Motivation & Objective

  • To assess the performance of AI workloads in browser-based execution environments compared to natively compiled code.
  • To evaluate the impact of modern browser runtime technologies—JavaScript, ASM.js, and WebAssembly—on algorithmic performance.
  • To identify performance bottlenecks and optimization opportunities in client-side AI computation.
  • To explore the feasibility of deploying federated and distributed machine learning directly in web browsers.

Proposed method

  • Benchmarked a representative set of 10 algorithms—ranging from sorting and graph traversal to signal processing and machine learning—across four execution environments: native C/C++, JavaScript, ASM.js, and WebAssembly.
  • Used Emscripten to compile C/C++ code into ASM.js and WebAssembly, ensuring feature parity across targets.
  • Executed all benchmarks in a controlled environment using consistent input data and hardware to isolate performance differences.
  • Measured execution time across multiple runs and reported median values with standard deviation to assess consistency.
  • Grouped results per algorithm on linear scales to better visualize relative performance gains across technologies.
  • Analyzed runtime behavior through profiling and speculated on underlying reasons for performance anomalies, especially WASM’s superiority.

Experimental results

Research questions

  • RQ1How does WebAssembly performance compare to native binary execution for computationally intensive AI algorithms in a browser environment?
  • RQ2To what extent do modern browser VM optimizations (e.g., JIT compilation, SIMD, parallelization) close or exceed native performance?
  • RQ3Why do certain algorithms show unexpected performance gains in WebAssembly despite being compiled from the same source as native code?
  • RQ4Can browser-based execution via WebAssembly become a viable alternative to native or server-side execution for federated and client-side machine learning?

Key findings

  • WebAssembly consistently outperformed native binary execution in several benchmarks, including Fast Fourier Transform and Floyd-Warshall, with performance gains exceeding 2x in some cases.
  • The performance gap between JavaScript and WebAssembly was substantial, with WASM achieving up to 10x speedup on compute-intensive algorithms like Permutations and IntCompare.
  • ASM.js showed moderate improvements over JavaScript but fell short of WebAssembly’s performance, particularly in vectorized and parallelizable workloads.
  • Surprisingly, WebAssembly achieved better performance than native code in algorithms like FillArrayRand and MinCuts, suggesting that VM-level optimizations in modern browsers can surpass traditional compilation.
  • Performance variance was highest in memory-intensive and random-access algorithms like FillArrayRand and IntCompare 1e7, indicating sensitivity to memory access patterns and VM memory management.
  • The results suggest that future optimizations in WebAssembly—such as native SIMD and shared-memory concurrency—could further close or exceed native performance in distributed and federated learning workloads.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.