<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/crosswalk-and-its-js-java-and-native-extensions-performance-2qnb8buqv" -->

---
title: Crosswalk and its JS, JAVA and Native Extensions performance
description: An exploration of Crosswalk-android's extension system, specifically how to bundle native (.so) libraries inside an APK and call them via Java extensions from...
canonical: https://daily.dev/posts/crosswalk-and-its-js-java-and-native-extensions-performance-2qnb8buqv
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Crosswalk and its JS, JAVA and Native Extensions performance | daily.dev
og:description: An exploration of Crosswalk-android's extension system, specifically how to bundle native (.so) libraries inside an APK and call them via Java extensions from...
og:url: https://daily.dev/posts/crosswalk-and-its-js-java-and-native-extensions-performance-2qnb8buqv
og:image: https://api.daily.dev/og/posts/2Qnb8BuqV.png
og:image:alt: Crosswalk and its JS, JAVA and Native Extensions performance
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Crosswalk and its JS, JAVA and Native Extensions performance

**[Collabora Blog](https://daily.dev/sources/collabora)** · 4 min read · 0 upvotes · 0 comments

## Summary

An exploration of Crosswalk-android's extension system, specifically how to bundle native (.so) libraries inside an APK and call them via Java extensions from JavaScript. Performance benchmarks compare JS, Java, and native C code using prime-finding and summation algorithms. Key findings: JS-to-Java or JS-to-Java-to-C context switching costs roughly 1ms per call, making native extensions slower for trivial operations. For compute-heavy tasks (50K element summation), native code is ~3x faster than JavaScript, as V8's smart optimizations (e.g., modulus tricks) don't apply. The takeaway: measure before optimizing, and avoid native calls inside tight loops.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.collabora.com/news-and-blog/blog/2015/02/05/crosswalk-js,-java-and-native-extensions-performance>

## Questions this post answers

### What is the performance cost of calling a native extension from JavaScript in Crosswalk-android?

The JS-to-Java or JS-to-Java-to-C context switch in Crosswalk-android costs just under 1ms per call. For small operations like summing 10 elements, this overhead makes native calls slower than pure JavaScript. For compute-heavy tasks like summing 50,000 elements, native code is roughly 3x faster than JavaScript, since V8's smart optimizations no longer close the gap.

_Developers weighing hybrid app architecture trade-offs like this track Crosswalk and WebView performance discussions on daily.dev._

### How do I include a native .so library inside a Crosswalk-android extension APK?

Add a copy step in the ant build.xml recipe between the unjar and jar tasks, placing the .so file into the correct ABI directory inside the extension package. For example: <copy file="libs/armeabi/libMyLibrary.so" todir="${build}/lib/armeabi-v7a/" />. This takes advantage of the extension JAR being opened and closed to include the META-INF, injecting the native library at the same time.

_Android developers bundling native code into hybrid apps find related build and packaging discussions on daily.dev._

## Similar posts on daily.dev

- [We Didn't Want to Build Another Java Server](https://daily.dev/posts/we-didn-t-want-to-build-another-java-server-rji0itet1) · Foojay.io · 20 upvotes · 0 comments
- [Clojure is almost as fast as C \(with some help\)](https://daily.dev/posts/clojure-is-almost-as-fast-as-c-with-some-help--faibfofkn) · Lobsters · 0 upvotes · 0 comments
- [WebAssembly vs. JavaScript: Testing Side-by-Side Performance](https://daily.dev/posts/webassembly-vs-javascript-testing-side-by-side-performance-uai1ulk0u) · The New Stack · 0 upvotes · 0 comments
- [Java Is Fast. Your Code Might Not Be.](https://daily.dev/posts/java-is-fast-your-code-might-not-be--melyfth7m) · Hacker News · 0 upvotes · 0 comments

---

Tags: [#javascript](https://daily.dev/tags/javascript), [#performance](https://daily.dev/tags/performance), [#android](https://daily.dev/tags/android)

[View this post on daily.dev](https://daily.dev/posts/crosswalk-and-its-js-java-and-native-extensions-performance-2qnb8buqv)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Crosswalk and its JS, JAVA and Native Extensions performance","url":"https://daily.dev/posts/crosswalk-and-its-js-java-and-native-extensions-performance-2qnb8buqv","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/crosswalk-and-its-js-java-and-native-extensions-performance-2qnb8buqv"},"datePublished":"2026-08-11T08:55:49.672Z","dateModified":"2026-08-11T09:37:20.972Z","description":"An exploration of Crosswalk-android's extension system, specifically how to bundle native (.so) libraries inside an APK and call them via Java extensions from...","image":"https://media.daily.dev/image/upload/s--VDukGCjf--/f_auto/v1722860399/public/Placeholder%2002","thumbnailUrl":"https://media.daily.dev/image/upload/s--VDukGCjf--/f_auto/v1722860399/public/Placeholder%2002","isAccessibleForFree":true,"articleSection":"Collabora Blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Collabora Blog","logo":"https://media.daily.dev/image/upload/s--ZGZ0FjqS--/f_auto,q_auto/v1786438306/logos/collabora?_a=BAMAMicg0","url":"https://daily.dev/sources/collabora"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/crosswalk-and-its-js-java-and-native-extensions-performance-2qnb8buqv","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"javascript,performance,android","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Collabora Blog","item":"https://daily.dev/sources/collabora"},{"@type":"ListItem","position":3,"name":"Crosswalk and its JS, JAVA and Native Extensions performance"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/crosswalk-and-its-js-java-and-native-extensions-performance-2qnb8buqv#faq","mainEntity":[{"@type":"Question","name":"What is the performance cost of calling a native extension from JavaScript in Crosswalk-android?","acceptedAnswer":{"@type":"Answer","text":"The JS-to-Java or JS-to-Java-to-C context switch in Crosswalk-android costs just under 1ms per call. For small operations like summing 10 elements, this overhead makes native calls slower than pure JavaScript. For compute-heavy tasks like summing 50,000 elements, native code is roughly 3x faster than JavaScript, since V8's smart optimizations no longer close the gap. Developers weighing hybrid app architecture trade-offs like this track Crosswalk and WebView performance discussions on daily.dev."}},{"@type":"Question","name":"How do I include a native .so library inside a Crosswalk-android extension APK?","acceptedAnswer":{"@type":"Answer","text":"Add a copy step in the ant build.xml recipe between the unjar and jar tasks, placing the .so file into the correct ABI directory inside the extension package. For example: <copy file=\"libs/armeabi/libMyLibrary.so\" todir=\"${build}/lib/armeabi-v7a/\" />. This takes advantage of the extension JAR being opened and closed to include the META-INF, injecting the native library at the same time. Android developers bundling native code into hybrid apps find related build and packaging discussions on daily.dev."}}]}
```

