×
1 Choose EITC/EITCA Certificates
2 Learn and take online exams
3 Get your IT skills certified

Confirm your IT skills and competencies under the European IT Certification framework from anywhere in the world fully online.

EITCA Academy

Digital skills attestation standard by the European IT Certification Institute aiming to support Digital Society development

LOG IN TO YOUR ACCOUNT

CREATE AN ACCOUNT FORGOT YOUR PASSWORD?

FORGOT YOUR PASSWORD?

AAH, WAIT, I REMEMBER NOW!

CREATE AN ACCOUNT

ALREADY HAVE AN ACCOUNT?
EUROPEAN INFORMATION TECHNOLOGIES CERTIFICATION ACADEMY - ATTESTING YOUR PROFESSIONAL DIGITAL SKILLS
  • SIGN UP
  • LOGIN
  • INFO

EITCA Academy

EITCA Academy

The European Information Technologies Certification Institute - EITCI ASBL

Certification Provider

EITCI Institute ASBL

Brussels, European Union

Governing European IT Certification (EITC) framework in support of the IT professionalism and Digital Society

  • CERTIFICATES
    • EITCA ACADEMIES
      • EITCA ACADEMIES CATALOGUE<
      • EITCA/CG COMPUTER GRAPHICS
      • EITCA/IS INFORMATION SECURITY
      • EITCA/BI BUSINESS INFORMATION
      • EITCA/KC KEY COMPETENCIES
      • EITCA/EG E-GOVERNMENT
      • EITCA/WD WEB DEVELOPMENT
      • EITCA/AI ARTIFICIAL INTELLIGENCE
    • EITC CERTIFICATES
      • EITC CERTIFICATES CATALOGUE<
      • COMPUTER GRAPHICS CERTIFICATES
      • WEB DESIGN CERTIFICATES
      • 3D DESIGN CERTIFICATES
      • OFFICE IT CERTIFICATES
      • BITCOIN BLOCKCHAIN CERTIFICATE
      • WORDPRESS CERTIFICATE
      • CLOUD PLATFORM CERTIFICATENEW
    • EITC CERTIFICATES
      • INTERNET CERTIFICATES
      • CRYPTOGRAPHY CERTIFICATES
      • BUSINESS IT CERTIFICATES
      • TELEWORK CERTIFICATES
      • PROGRAMMING CERTIFICATES
      • DIGITAL PORTRAIT CERTIFICATE
      • WEB DEVELOPMENT CERTIFICATES
      • DEEP LEARNING CERTIFICATESNEW
    • CERTIFICATES FOR
      • EU PUBLIC ADMINISTRATION
      • TEACHERS AND EDUCATORS
      • IT SECURITY PROFESSIONALS
      • GRAPHICS DESIGNERS & ARTISTS
      • BUSINESSMEN AND MANAGERS
      • BLOCKCHAIN DEVELOPERS
      • WEB DEVELOPERS
      • CLOUD AI EXPERTSNEW
  • FEATURED
  • SUBSIDY
  • HOW IT WORKS
  •   IT ID
  • ABOUT
  • CONTACT
  • MY ORDER
    Your current order is empty.
EITCIINSTITUTE
CERTIFIED

Why is JAX faster than NumPy?

by MIRNA HANŽEK / Thursday, 27 November 2025 / Published in Artificial Intelligence, EITC/AI/GCML Google Cloud Machine Learning, Google Cloud AI Platform, Introduction to JAX

JAX achieves higher performance compared to NumPy due to its advanced compilation techniques, hardware acceleration capabilities, and functional programming paradigms. The performance gap arises from both architectural differences and the way JAX interacts with modern computing hardware, particularly accelerators like GPUs and TPUs.

1. Architecture and Execution Model

NumPy is fundamentally a library for high-performance numerical computation in Python. It provides efficient, vectorized operations using precompiled C code via its C API (often through BLAS/LAPACK backends). Despite its efficiency on CPUs, NumPy is limited to single-threaded execution for most operations and does not natively support execution on GPUs or TPUs.

In contrast, JAX is built with a functional programming model and leverages the [XLA (Accelerated Linear Algebra)](https://www.tensorflow.org/xla) compiler backend. JAX operations are described as Python functions, which JAX can transform, compile, and optimize for various hardware targets. This architecture enables JAX to provide features such as:

– Just-In-Time (JIT) compilation of NumPy-like code into highly optimized machine code for CPUs, GPUs, and TPUs.
– Automatic vectorization and parallelization across devices.
– Transparent hardware acceleration without code changes.

2. Just-In-Time (JIT) Compilation and XLA

A cornerstone of JAX’s speed advantage is JIT compilation, which is enabled by the `jax.jit` decorator. When a function is decorated with `@jax.jit`, JAX traces the function, builds a computation graph, and compiles it into highly optimized machine instructions using XLA. XLA applies aggressive optimizations such as operation fusion, loop unrolling, and constant folding, which are not available in standard NumPy.

Example: JIT Compilation
python
import jax
import jax.numpy as jnp

def my_function(x):
    return jnp.sin(x) * jnp.exp(x)

# Regular execution (interpreted)
result_np = my_function(jnp.arange(1000000))

# JIT-compiled execution
jit_my_function = jax.jit(my_function)
result_jit = jit_my_function(jnp.arange(1000000))

The JIT-compiled version executes faster, especially for large arrays, because the entire computation is compiled as a single kernel, reducing Python overhead and taking full advantage of hardware-specific optimizations.

3. Hardware Acceleration

NumPy operations run on the CPU and do not natively support execution on GPUs or TPUs. While there are projects like CuPy that provide NumPy-like APIs for GPUs, the original NumPy does not have this capability. JAX, by default, can dispatch computations to available accelerators, including both GPUs and TPUs.

This feature is particularly significant for machine learning workloads, which routinely involve large-scale matrix and tensor operations. For instance, training neural networks on large datasets is considerably faster on GPUs or TPUs due to their parallel computational capabilities. JAX allows seamless hardware switching without code modification, leveraging the best available hardware.

Example: GPU/TPU Usage
python
import jax.numpy as jnp
from jax import device_put

# Automatically runs on GPU/TPU if available
x = jnp.ones((10000, 10000))
y = jnp.dot(x, x)

If a GPU or TPU is present, the computation is offloaded, yielding significant speedups compared to CPU-bound NumPy.

4. Automatic Differentiation

Though not directly related to speed, JAX’s automatic differentiation (`jax.grad`, `jax.value_and_grad`, etc.) is built atop its functional and compiled architecture. This feature enables efficient computation of derivatives, which is highly beneficial in machine learning and optimization.

JAX traces the computation to construct a computational graph, which it can then differentiate and compile. Because both the original function and its derivatives can be JIT-compiled, performance remains high without the interpretive overhead seen in other frameworks.

5. Operation Fusion

One of the most impactful optimizations by XLA is operation fusion. In NumPy, a sequence of array operations (such as a chain of arithmetic, trigonometric, or reduction operations) results in each operation materializing intermediate arrays in memory. This increases memory usage and often involves redundant passes over data.

In JAX, using XLA, multiple operations can be fused into a single kernel. This not only minimizes memory accesses but also reduces latency and increases cache efficiency.

Example: Operation Fusion
python
import numpy as np

x_np = np.arange(1000000)
y_np = np.sin(x_np) * np.exp(x_np) + np.log(x_np + 1)

# Each operation (sin, exp, log, add, multiply) creates an intermediate array.

In JAX, the equivalent code can be fused into a single kernel:

python
import jax.numpy as jnp

x_jnp = jnp.arange(1000000)
y_jnp = jnp.sin(x_jnp) * jnp.exp(x_jnp) + jnp.log(x_jnp + 1)

When JIT-compiled, this computation is performed in one pass, without unnecessary intermediates.

6. Functional Programming Paradigm

JAX is designed with pure functional programming in mind. Functions have no side effects and operate only on their inputs to produce outputs. This statelessness allows aggressive optimizations, such as:

– Function transformations (e.g., vectorization with `vmap`, parallelization with `pmap`)
– Efficient computation graph tracing
– Deterministic compilation and caching

NumPy, on the other hand, allows side effects and in-place modifications, which preclude some of these optimizations and necessitate more conservative execution.

7. Parallelization and Vectorization

NumPy supports parallelism primarily through external libraries (e.g., OpenMP-enabled BLAS), but this is limited and often not exposed to the user. JAX introduces functional transformations:

– `jax.vmap`: Automatic vectorization over batches of data without explicit for-loops.
– `jax.pmap`: Parallelization across multiple devices (multi-GPU or TPU).

These capabilities enable large-scale data-parallel computation, which is highly beneficial in machine learning and scientific computing.

Example: Vectorization with `vmap`
python
import jax
import jax.numpy as jnp

def f(x):
    return jnp.sin(x) * jnp.exp(x)

# Vectorize f over the leading axis
batched_f = jax.vmap(f)
x = jnp.linspace(0, 10, 1000)
y = batched_f(x)

This avoids Python loops, providing efficient parallel execution.

8. Reduced Python Overhead

In NumPy, each operation involves Python interpreter overhead, especially when chaining multiple operations or looping. JAX mitigates this by tracing and compiling entire computation graphs, resulting in minimal interaction with the Python interpreter during execution.

For large-scale computations, this reduction in interpreter overhead contributes significantly to performance gains, particularly when combined with JIT compilation and hardware acceleration.

9. Memory Efficiency

Due to operation fusion and avoidance of temporary intermediate arrays, JAX often uses less memory compared to NumPy for complex expressions. This efficiency is particularly advantageous on memory-constrained devices such as GPUs and TPUs, allowing for larger batch sizes or models.

10. Ecosystem Integration and Cloud Support

JAX is designed to work natively with Google Cloud AI Platform and other cloud-based machine learning infrastructure. It can leverage managed hardware resources, distributed computation, and integration with cloud storage and pipelines. NumPy lacks direct support for these features, requiring additional tooling for similar capabilities.

11. Example: Performance Comparison

Consider the task of computing the sum of elementwise products of two large arrays:

python
import numpy as np
import time

x_np = np.random.rand(10000000)
y_np = np.random.rand(10000000)

start = time.time()
result_np = np.sum(x_np * y_np)
end = time.time()
print("NumPy time:", end - start)

Equivalent code in JAX:

python
import jax.numpy as jnp
import jax

x_jnp = jnp.random.rand(10000000)
y_jnp = jnp.random.rand(10000000)

@jax.jit
def compute_sum(x, y):
    return jnp.sum(x * y)

start = time.time()
result_jax = compute_sum(x_jnp, y_jnp).block_until_ready()
end = time.time()
print("JAX time:", end - start)

On compatible hardware (especially GPU), the JAX implementation often outperforms NumPy due to compilation, fusion, and hardware acceleration.

12. Limitations and Trade-offs

While JAX offers numerous performance benefits, certain trade-offs exist:

– Compilation overhead: The first call to a JIT-compiled function incurs extra time due to tracing and compilation. Subsequent calls are faster.
– Limited support for in-place updates: For functional purity, JAX discourages in-place modification, which may require code adaptation.
– Dependency on accelerator hardware: Peak performance gains are most noticeable when using GPUs or TPUs.

Despite these considerations, for workloads relevant to machine learning, scientific computing, and large-scale data processing, JAX’s advantages are significant.

JAX surpasses NumPy in speed for many numerical and machine learning workloads due to its JIT compilation via XLA, native hardware acceleration support, operation fusion, functional programming model, and advanced parallelization mechanisms. These design choices enable JAX to efficiently utilize modern hardware infrastructure, minimize memory and computational overhead, and scale to large, complex computations with ease, making it a preferred choice for high-performance scientific and machine learning applications.

Other recent questions and answers regarding Introduction to JAX:

  • How to install JAX on Hailo 8?
  • How does JAX handle training deep neural networks on large datasets using the vmap function?
  • What are the features of JAX that allow for maximum performance in the Python environment?
  • How does JAX leverage XLA to achieve accelerated performance?
  • What are the two modes of differentiation supported by JAX?
  • What is JAX and how does it speed up machine learning tasks?

More questions and answers:

  • Field: Artificial Intelligence
  • Programme: EITC/AI/GCML Google Cloud Machine Learning (go to the certification programme)
  • Lesson: Google Cloud AI Platform (go to related lesson)
  • Topic: Introduction to JAX (go to related topic)
Tagged under: Artificial Intelligence, GPU, Hardware Acceleration, JAX, JIT Compilation, NumPy, Operation Fusion, Parallelization, TPU, XLA
Home » Artificial Intelligence » EITC/AI/GCML Google Cloud Machine Learning » Google Cloud AI Platform » Introduction to JAX » » Why is JAX faster than NumPy?

Certification Center

USER MENU

  • My Account

CERTIFICATE CATEGORY

  • EITC Certification (105)
  • EITCA Certification (9)

What are you looking for?

  • Introduction
  • How it works?
  • EITCA Academies
  • EITCI DSJC Subsidy
  • Full EITC catalogue
  • Your order
  • Featured
  •   IT ID
  • EITCA reviews (Medium publ.)
  • About
  • Contact

EITCA Academy is a part of the European IT Certification framework

The European IT Certification framework has been established in 2008 as a Europe based and vendor independent standard in widely accessible online certification of digital skills and competencies in many areas of professional digital specializations. The EITC framework is governed by the European IT Certification Institute (EITCI), a non-profit certification authority supporting information society growth and bridging the digital skills gap in the EU.
Eligibility for EITCA Academy 90% EITCI DSJC Subsidy support
90% of EITCA Academy fees subsidized in enrolment

    EITCA Academy Secretary Office

    European IT Certification Institute ASBL
    Brussels, Belgium, European Union

    EITC / EITCA Certification Framework Operator
    Governing European IT Certification Standard
    Access contact form or call +32 25887351

    Follow EITCI on X
    Visit EITCA Academy on Facebook
    Engage with EITCA Academy on LinkedIn
    Check out EITCI and EITCA videos on YouTube

    Funded by the European Union

    Funded by the European Regional Development Fund (ERDF) and the European Social Fund (ESF) in series of projects since 2007, currently governed by the European IT Certification Institute (EITCI) since 2008

    Information Security Policy | DSRRM and GDPR Policy | Data Protection Policy | Record of Processing Activities | HSE Policy | Anti-Corruption Policy | Modern Slavery Policy

    Automatically translate to your language

    Terms and Conditions | Privacy Policy
    EITCA Academy
    • EITCA Academy on social media
    EITCA Academy


    © 2008-2026  European IT Certification Institute
    Brussels, Belgium, European Union

    TOP

    We care about your privacy

    EITCI uses cookies and similar technologies to keep this site secure, remember your choices, provide personalized experience, measure the traffic, serve more relevant content and certification programmes. You can accept all cookies or customize your preferences. Cookies are variables used to store website specific information on your device to facilitate processing of data for personalized website visit, such as login to your account, accessing the programmes, placing enrolment orders in chosen programmes and improving your EITC certification journey. You can change or withdraw your consent at any time by clicking the Consent Preferences button at the left-bottom of your screen. We respect your choices and are committed to providing you with a transparent and secure browsing experience, which may be limited when cookies aren't accepted. For more details refer to the Privacy Policy
    Customize Consent Preferences
    We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.
    The cookies categorized as Necessary are stored on your browser as they are essential for enabling the basic functionalities of the site.
    To learn more about how Google processes personal information, visit: Google privacy policy

    Necessary

    Always Active

    Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

    Functional

    Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

    Preferences

    Stores personalization choices such as interface preferences.

    External media and social features

    Allows embedded video, social, chat, and external interactive services that may set their own cookies. Keep off until the user chooses these features.

    Analytics

    Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

    Marketing and conversions

    Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

    CHAT WITH SUPPORT
    Do you have any questions?
    Attach files with the paperclip or paste screenshots into the message box (Ctrl+V). Max 5 file(s), 10 MB each.
    We will reply here and by email. Your conversation is tracked with a support token.