microjob
react-native-multithreading
microjob | react-native-multithreading | |
---|---|---|
2 | 8 | |
2,018 | 1,102 | |
- | - | |
0.0 | 0.0 | |
over 1 year ago | over 1 year ago | |
TypeScript | C++ | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
microjob
-
Ship it!
node.js is multithreaded under the hood and always has been. It's true that we used to not have multi thread capability as developers, but we actually have for several years now, but most developers have probably never used it. Even prior to Worker Threads/Shared Buffers, we had 3rd party modules such as node-fiber and various shared memory data structure libraries which could be used to build multi threaded javascript programs. https://github.com/wilk/microjob <- dead simple batteries included multi threading in node.js
-
Should all functions be async?
Real life example: We wanted our website to be static files to save on system time as a kind of caching strategy. So far there are about 100 pages that need to be rendered sometimes when there is an update to the site. Running all of this through our templating engine at once caused the node server to be unresponsive for about 30 to 40 seconds. No joy. There are a few ways to solve this but the one we decided on was to use web worker threads for this execution because this was not going to happen very often. About 5% to 10% of the time. It basically just puts this function (rendering all of the pages) into another thread and returns the result. Now this takes about 15 to 20 seconds and does not hold up the main thread. We used a library called Microjob that makes using a web worker really easy https://github.com/wilk/microjob
react-native-multithreading
-
Not a good Time to Start with RN?
You can look at MMKV, Vision Camera and some other libs based on JSI which work pretty fast. https://github.com/mrousavy/react-native-mmkv https://github.com/mrousavy/react-native-vision-camera https://github.com/mrousavy/react-native-multithreading
- Have you guys tried multi threading or spawning a new process for expensive tasks ?
-
Why do people confuses async await with multithreading and how does it work in different language?
https://mobidev.biz/blog/how-react-native-app-development-works https://github.com/mrousavy/react-native-multithreading
-
React Native - when JS is too busy
โ๏ธ take advantage of the next coming React Native architecture JSI + Fabric Rendering + Turbo Modules
-
Sponsoring open source projects, share about your project
react-native-multithreading: A library for spawning a secondary JavaScript runtime to run code in there. Pretty experimental
-
Best way to upload large files (images) as a background task in React Native?
Have a look into react-native-multithreading.
-
Using Kotlin cross platform with react native
Have you seen https://github.com/mrousavy/react-native-multithreading? Reanimated2 opens the doors to spinning up new JS threads. So we could essentially have multi-threaded JavaScript and avoid dropping down to the native layer at all ๐.
-
I made a react native library that lets you run JS code on a separate thread, fully parallel, awaitable and performant.
Here's an example on how easy it is to use: const result = await spawnThread(() => { 'worklet' // expensive calculation return ... }) See mrousavy/react-native-multithreading (GitHub) for more details.
What are some alternatives?
threads.js - ๐งต Make web workers & worker threads as simple as a function call.
react-native-reanimated - React Native's Animated library reimplemented
libev - Full-featured high-performance event loop loosely modelled after libevent
react-native-mmkv - โก๏ธ The fastest key/value storage for React Native. ~30x faster than AsyncStorage!
threadedClass - Fork instances of classes with one line of code, all while retaining the types of the class.
gpx-converter - python package for manipulating gpx files and easily converting gpx to other different formats
Joplin - Joplin - the secure note taking and to-do app with synchronisation capabilities for Windows, macOS, Linux, Android and iOS.
rn-ldk - Lightweight lightning node for React Native
jobber - ๐ผ Super simple API to fetch job listings from popular job boards (Ashby, Greenhouse, Lever, etc.)
react-native-vision-camera - ๐ธ A powerful, high-performance React Native Camera library.
neutralinojs - Portable and lightweight cross-platform desktop application development framework
uniq - A lock-free (multi reader / multi writer) circular buffered queue.