Skip to content

Instantly share code, notes, and snippets.

View mrousavy's full-sized avatar
🐍
slime season

Marc Rousavy mrousavy

🐍
slime season
View GitHub Profile
@mrousavy
mrousavy / README.md
Created November 2, 2026 14:16
Nitro small-array benchmarks: bulk insertion versus indexed stores, sizes 1–8

Small-array construction followup

This fixture measures sizes 2–7, with sizes 1 and 8 as same-run controls, for the three implementations from the original array benchmark:

  1. Stack or resize/assignment temporary buffer, followed by one bulk Array::push.
  2. Stack buffer through eight elements, otherwise reserve/emplace_back, followed by one bulk push.
  3. Pre-sized JS array populated with setValueAtIndex.

baseline.hpp, reserve.hpp and direct.hpp are byte-identical to the original snapshots. benchmark.cpp keeps the original array timing code and changes only measured sizes, process seeds and removal of tuple timing cases. It includes numbers, rooted object/string references, and freshly created ASCII strings. Original results and artifacts were preserved separately.

@mrousavy
mrousavy / BaselineVariant.hpp
Created November 2, 2026 13:16
Nitro struct variant decoding benchmarks: repeated reads versus prepared fields
//
// Created by Marc Rousavy on 21.02.24.
//
#pragma once
#include <NitroModules/JSIConverter.hpp>
#include <NitroModules/NitroTypeInfo.hpp>
#include <jsi/jsi.h>
#include <memory>
@mrousavy
mrousavy / README.md
Created November 2, 2026 13:04
Nitro JSI array construction benchmarks: bulk resize, bulk emplace, direct indexed stores

JSI array construction comparison

This fixture compares three implementations in one executable:

  1. The current resize/assignment temporary buffer followed by one bulk Array::push.
  2. A stack buffer for at most eight elements, otherwise reserve/emplace_back, followed by one bulk push.
  3. A pre-sized JS array populated with setValueAtIndex.

baseline.hpp, reserve.hpp, and direct.hpp are namespaced snapshots of the actual implementations. The baseline is Nitro commit cdaf72e60; the candidate snapshots match the two comparison PRs. TupleBaseline.hpp and TupleDirect.hpp contain the actual tuple converter bodies with only the converter class names changed so both can coexist in one executable. The reserve PR keeps the tuple implementation unchanged.

@mrousavy
mrousavy / Hermes-build-commands.sh
Last active February 15, 2025 19:22
Static Hermes benchmark
# 1. Build Hermes off of static_h branch.
# 2. Run these commands:
# Static Hermes
build/bin/shermes -strict -parse-ts -finline -O -typed main.ts
./a.out
# BENCHMARK: 50000 iterations took 12818.000ms
# Hermes
build/bin/hermes -O -finline -parse-ts main.ts
@mrousavy
mrousavy / withNoBundleCompression.js
Created February 15, 2025 18:15
Expo Config Plugin to disable JS bundle compression for faster app startup
const {withAppBuildGradle} = require('@expo/config-plugins')
/**
* A Config Plugin to disable bundle compression in Android build.gradle.
* This makes the Android app start faster - in our tests by 400ms!
* @param {import('@expo/config-plugins').ConfigPlugin} config
* @returns {import('@expo/config-plugins').ConfigPlugin}
*/
module.exports = function withNoBundleCompression(config) {
return withAppBuildGradle(config, androidConfig => {
@mrousavy
mrousavy / matrix.svg
Last active January 15, 2024 16:34
Matrix animation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mrousavy
mrousavy / camera-blackscreen-logs.txt
Created October 17, 2023 15:49
VisionCamera V3 bug logs; navigating away and back results in a blackscreen (tested in Expensify)
2023-10-17 17:47:28.443 24007-24540 AudioManager com.expensify.chat.dev V playSoundEffect effectType: 0
2023-10-17 17:47:28.444 24007-24540 AudioManager com.expensify.chat.dev V querySoundEffectsEnabled...
2023-10-17 17:47:28.455 24007-24007 CameraView com.expensify.chat.dev D Finding view 1909...
2023-10-17 17:47:28.455 24007-24007 CameraView com.expensify.chat.dev D Found view 1909!
2023-10-17 17:47:28.483 24007-24376 CameraView.takePhoto com.expensify.chat.dev I Taking photo... Options: {qualityPrioritization=speed, flash=off}
2023-10-17 17:47:28.487 24007-24376 CameraSession com.expensify.chat.dev I Photo capture 0/3 - preparing capture request (3968x2976)...
2023-10-17 17:47:28.499 24007-24376 CameraSession com.expensify.chat.dev I Photo capture 1/3 - starting capture...
2023-10-17 17:47:28.537 24007-24007 ViewRootImpl
@mrousavy
mrousavy / devices-iphone11-pro.json
Created October 3, 2023 10:39
VisionCamera Devices (iPhone 15 Pro and iPhone 11 Pro)
[
{
"devices": [
"ultra-wide-angle-camera",
"wide-angle-camera",
"telephoto-camera"
],
"hasTorch": true,
"hasFlash": true,
"name": "Back Triple Camera",
@mrousavy
mrousavy / private-jsi-consulting.cpp
Created November 2, 2021 14:01
Notes from the JSI Consulting Session
/**
* jsi::Value
* - .asNumber() -> double
* - .asBoolean() -> bool
* - jsi::Value::undefined()
* - jsi::Value::null()
* - jsi::String
* - jsi::Symbol
* - jsi::Object
@mrousavy
mrousavy / settings.json
Last active September 9, 2021 19:59
My VSCode settings + themes + extensions
// VSCode Settings (hit `Cmd + ,` to open settings)
{
"editor.smoothScrolling": true,
"editor.fontSize": 16,
"editor.fontFamily": "Fira Mono, Consolas, 'Courier New', monospace",
"editor.wordWrap": "on",
"editor.tabCompletion": "on",
"explorer.openEditors.visible": 0,
"explorer.autoReveal": false,