This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Library for photo compression used as example in presentation: | |
https://www.npmjs.com/package/react-native-photo-compressor | |
Article about turbo modules vs platform channel performance (needs VPN) | |
https://medium.com/@islamrustamov/obj-c-turbo-module-vs-c-turbo-module-vs-flutter-platform-channel-e610a344ec92 | |
Discussion with William Candillon about animation performance | |
https://github.com/Shopify/react-native-skia/discussions/1824 | |
Example of template for RN project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:math'; | |
import 'package:flutter/material.dart'; | |
import 'package:statsfl/statsfl.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Canvas, | |
Group, | |
Rect, | |
useComputedValue, | |
mix, | |
vec, | |
SkiaValue, | |
useTiming, | |
} from '@shopify/react-native-skia'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setCenteredIndex(Math.round(e.nativeEvent.contentOffset.y / blockSize)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const height = Dimensions.get('window').height; | |
const blockSize = 70; | |
function ItemSeparator() { | |
return <View style={{height: 10}} />; | |
} | |
function ListSpacer() { | |
return <View style={{height: height / 2 - blockSize}} />; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Article { | |
title: string; | |
date: string; | |
} | |
// ... | |
interface ArticleBlockProps extends Article { | |
isCenter: boolean; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<void> _sort() async { | |
try { | |
double mean = 0; | |
for (var i = 0; i < 1000; i++) { | |
final stopwatch = Stopwatch()..start(); | |
await platform.invokeMethod('sort', list10); | |
stopwatch.stop(); | |
// Don't worry, I converted it to milliseconds afterwards |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sortObjectiveC = async arr => { | |
let mean = 0; | |
for (let i = 0; i < 1000; i++) { | |
const startTime = performance.now(); | |
await RTNSorter?.sort(arr); | |
const endTime = performance.now(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sortCPP = arr => { | |
let mean = 0; | |
for (let i = 0; i < 1000; i++) { | |
const startTime = performance.now(); | |
NativeSampleModule.sort(arr); | |
const endTime = performance.now(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private func sort(result: FlutterResult, _ array: [Int]) { | |
var arr = array | |
for _ in 0...arr.count { | |
for value in 1...arr.count - 1 { | |
if arr[value-1] > arr[value] { | |
let largerValue = arr[value-1] | |
arr[value-1] = arr[value] | |
arr[value] = largerValue | |
} | |
} |
NewerOlder