Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnable
import com.facebook.react.defaults.DefaultReactActivityDelegate
import expo.modules.ReactActivityDelegateWrapper

import com.oblador.performance.RNPerformance

class MainActivity : ReactActivity() {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
Expand Down Expand Up @@ -117,6 +115,5 @@ class MainActivity : ReactActivity() {

override fun onStart() {
super.onStart()
RNPerformance.getInstance().mark("appCreationEnd", false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.react.modules.i18nmanager.I18nUtil
import com.facebook.react.soloader.OpenSourceMergedSoMapping
import com.facebook.soloader.SoLoader
import com.oblador.performance.RNPerformance
import expo.modules.ApplicationLifecycleDispatcher
import expo.modules.ReactNativeHostWrapper
import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
Expand Down Expand Up @@ -58,7 +57,6 @@ class MainApplication : MultiDexApplication(), ReactApplication {
ReactFontManager.getInstance().addCustomFont(this, "Expensify New Kansas", R.font.expensify_new_kansas)
ReactFontManager.getInstance().addCustomFont(this, "Expensify Neue", R.font.expensify_neue)
ReactFontManager.getInstance().addCustomFont(this, "Expensify Mono", R.font.expensify_mono)
RNPerformance.getInstance().mark("appCreationStart", false);

if (isOnfidoProcess()) {
return
Expand Down
30 changes: 1 addition & 29 deletions contributingGuides/PERFORMANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,34 +236,6 @@ https://github.com/user-attachments/assets/39e8514a-caac-4296-b837-b986e088fa9a

You need to have the web server running. The app will open in a separate browser window.

### Performance Metrics (Opt-In on local release builds)

To capture reliable performance metrics for native app launch, we must test against a release build. To make this easier for everyone to do, we created an opt-in tool (using [`react-native-performance`](https://github.com/oblador/react-native-performance)) that will capture metrics and display them in an alert once the app becomes interactive. To set this up, just set `CAPTURE_METRICS=true` in your `.env` file, then create a release build on iOS or Android. The metrics this tool shows are as follows:

- `nativeLaunch` - Total time for the native process to initialize
- `runJSBundle` - Total time to parse and execute the JS bundle
- `timeToInteractive` - Rough TTI (Time to Interactive). Includes native init time + sidebar UI partially loaded

#### How to create a Release Build on Android

- Create a keystore by running `keytool -genkey -v -keystore your_key_name.keystore -alias your_key_alias -keyalg RSA -keysize 2048 -validity 10000`
- Fill out all the prompts with any info and give it a password
- Drag the generated keystore to `/android/app`
- Hardcode the values to the gradle config like so:

```
signingConfigs {
release {
storeFile file('your_key_name.keystore')
storePassword 'Password1'
keyAlias 'your_key_alias'
keyPassword 'Password1'
}
}
```
- Delete any existing apps off emulator or device
- Run `react-native run-android --variant release`

## Example Performance Optimization Proposals

Here are examples of well-documented performance optimization proposals that demonstrate good practices for investigating, profiling, and fixing performance issues:
Expand All @@ -285,7 +257,7 @@ Another option is to use `React.memo()` with a custom comparison function to pre

React might still take some time to re-render a component when its parent component renders. If it takes a long time to re-render the child even though we have no props changing, then we can use `React.memo()` which will "shallow compare" the `props` to see if a component should re-render.

If you aren't sure what exactly is changing about some deeply nested object prop, you can use `Performance.diffObject()` in `React.memo()` method which should show you exactly what is changing from one update to the next.
If you aren't sure what exactly is changing about some deeply nested object prop, you can add a temporary custom comparison function to `React.memo()` that logs the differences between previous and next props, which should show you exactly what is changing from one update to the next.

**Suggested resource:** [React Docs - Preserving and Resetting state](https://react.dev/learn/preserving-and-resetting-state)

Expand Down
32 changes: 0 additions & 32 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2564,34 +2564,6 @@ PODS:
- ReactCommon/turbomodule/core
- SocketRocket
- Yoga
- react-native-performance (6.0.0):
- boost
- DoubleConversion
- fast_float
- fmt
- glog
- hermes-engine
- RCT-Folly
- RCT-Folly/Fabric
- RCTRequired
- RCTTypeSafety
- React-Core
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-ImageManager
- React-jsi
- React-NativeModulesApple
- React-RCTFabric
- React-renderercss
- React-rendererdebug
- React-utils
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- SocketRocket
- Yoga
- react-native-plaid-link-sdk (12.5.3):
- boost
- DoubleConversion
Expand Down Expand Up @@ -4122,7 +4094,6 @@ DEPENDENCIES:
- "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)"
- react-native-pager-view (from `../node_modules/react-native-pager-view`)
- react-native-pdf (from `../node_modules/react-native-pdf`)
- react-native-performance (from `../node_modules/react-native-performance`)
- react-native-plaid-link-sdk (from `../node_modules/react-native-plaid-link-sdk`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- "react-native-skia (from `../node_modules/@shopify/react-native-skia`)"
Expand Down Expand Up @@ -4391,8 +4362,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-pager-view"
react-native-pdf:
:path: "../node_modules/react-native-pdf"
react-native-performance:
:path: "../node_modules/react-native-performance"
react-native-plaid-link-sdk:
:path: "../node_modules/react-native-plaid-link-sdk"
react-native-safe-area-context:
Expand Down Expand Up @@ -4632,7 +4601,6 @@ SPEC CHECKSUMS:
react-native-netinfo: f94b3a0fc305e812f3f615989d99299d7110c2ae
react-native-pager-view: c62ab82db28e2d11e7809c59085e2984a45979c5
react-native-pdf: 6a09a9be0e7ee954ea671437483316f9a28f8572
react-native-performance: a7a65d0b0f3055c5db33e1433e4345143ef6a100
react-native-plaid-link-sdk: 425c0a3a923310fcd8489142209ff1508372a7bf
react-native-safe-area-context: 0a3b034bb63a5b684dd2f5fffd3c90ef6ed41ee8
react-native-skia: 51f30133876025c83e933f4f7253479e6de5d937
Expand Down
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@
"react-native-onyx": "3.0.35",
"react-native-pager-view": "8.0.0",
"react-native-pdf": "7.0.2",
"react-native-performance": "^6.0.0",
"react-native-permissions": "^5.4.0",
"react-native-picker-select": "git+https://github.com/Expensify/react-native-picker-select.git#07d60d78d4772d47afd7a744940fc6b6d1881806",
"react-native-plaid-link-sdk": "12.5.3",
Expand Down
27 changes: 0 additions & 27 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1717,48 +1717,21 @@ const CONST = {
},
},
TIMING: {
GET_ORDERED_REPORT_IDS: 'get_ordered_report_ids',
CALCULATE_MOST_RECENT_LAST_MODIFIED_ACTION: 'calc_most_recent_last_modified_action',
SPLASH_SCREEN: 'splash_screen',
OPEN_SEARCH: 'open_search',
OPEN_REPORT: 'open_report',
OPEN_REPORT_FROM_PREVIEW: 'open_report_from_preview',
OPEN_REPORT_THREAD: 'open_report_thread',
OPEN_REPORT_SEARCH: 'open_report_search',
SIDEBAR_LOADED: 'sidebar_loaded',
LOAD_SEARCH_OPTIONS: 'load_search_options',
SEND_MESSAGE: 'send_message',
SUBMIT_EXPENSE: 'submit_expense',
NAVIGATE_AFTER_EXPENSE_CREATE: 'navigate_after_expense_create',
OPEN_CREATE_EXPENSE: 'open_create_expense',
OPEN_CREATE_EXPENSE_CONTACT: 'open_create_expense_contact',
OPEN_CREATE_EXPENSE_APPROVE: 'open_create_expense_approve',
APPLY_AIRSHIP_UPDATES: 'apply_airship_updates',
APPLY_PUSHER_UPDATES: 'apply_pusher_updates',
APPLY_HTTPS_UPDATES: 'apply_https_updates',
COLD: 'cold',
WARM: 'warm',
REPORT_ACTION_ITEM_LAYOUT_DEBOUNCE_TIME: 1500,
SHOW_LOADING_SPINNER_DEBOUNCE_TIME: 250,
TEST_TOOLS_MODAL_THROTTLE_TIME: 800,
TOOLTIP_SENSE: 1000,
TRIE_INITIALIZATION: 'trie_initialization',
COMMENT_LENGTH_DEBOUNCE_TIME: 1500,
SEARCH_OPTION_LIST_DEBOUNCE_TIME: 300,
SUGGESTION_DEBOUNCE_TIME: 100,
RESIZE_DEBOUNCE_TIME: 100,
UNREAD_UPDATE_DEBOUNCE_TIME: 300,
SEARCH_FILTER_OPTIONS: 'search_filter_options',
USE_DEBOUNCED_STATE_DELAY: 300,
LIST_SCROLLING_DEBOUNCE_TIME: 200,
PUSHER_PING_PONG: 'pusher_ping_pong',
LOCATION_UPDATE_INTERVAL: 5000,
PLAY_SOUND_MESSAGE_DEBOUNCE_TIME: 500,
NOTIFY_NEW_ACTION_DELAY: 700,
SKELETON_ANIMATION_SPEED: 3,
SEARCH_MOST_RECENT_OPTIONS: 'search_most_recent_options',
DEBOUNCE_HANDLE_SEARCH: 'debounce_handle_search',
FAST_SEARCH_TREE_CREATION: 'fast_search_tree_creation',
SHOW_HOVER_PREVIEW_DELAY: 270,
SHOW_HOVER_PREVIEW_ANIMATION_DURATION: 250,
ACTIVITY_INDICATOR_TIMEOUT: 10000,
Expand Down
2 changes: 0 additions & 2 deletions src/components/LHNOptionsList/OptionRowLHN.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import DomUtils from '@libs/DomUtils';
import {containsCustomEmoji as containsCustomEmojiUtils, containsOnlyCustomEmoji} from '@libs/EmojiUtils';
import FS from '@libs/Fullstory';
import {shouldOptionShowTooltip, shouldUseBoldText} from '@libs/OptionsListUtils';
import Performance from '@libs/Performance';
import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager';
import {isAdminRoom, isChatUsedForOnboarding as isChatUsedForOnboardingReportUtils, isConciergeChatReport, isGroupChat, isOneOnOneChat, isSystemChat} from '@libs/ReportUtils';
import {startSpan} from '@libs/telemetry/activeSpans';
Expand Down Expand Up @@ -177,7 +176,6 @@ function OptionRowLHN({
const alternateTextFSClass = FS.getChatFSClass(report);

const onOptionPress = (event: GestureResponderEvent | KeyboardEvent | undefined) => {
Performance.markStart(CONST.TIMING.OPEN_REPORT);
startSpan(`${CONST.TELEMETRY.SPAN_OPEN_REPORT}_${reportID}`, {
name: 'OptionRowLHN',
op: CONST.TELEMETRY.SPAN_OPEN_REPORT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import {convertToDisplayString} from '@libs/CurrencyUtils';
import {canUseTouchScreen} from '@libs/DeviceCapabilities';
import {getTotalAmountForIOUReportPreviewButton} from '@libs/MoneyRequestReportUtils';
import Navigation from '@libs/Navigation/Navigation';
import Performance from '@libs/Performance';
import {getConnectedIntegration, hasDynamicExternalWorkflow} from '@libs/PolicyUtils';
import {hasPendingDEWSubmit} from '@libs/ReportActionsUtils';
import {getInvoicePayerName} from '@libs/ReportNameUtils';
Expand Down Expand Up @@ -553,7 +552,6 @@ function MoneyRequestReportPreviewContent({
if (!iouReportID) {
return;
}
Performance.markStart(CONST.TIMING.OPEN_REPORT_FROM_PREVIEW);
startSpan(`${CONST.TELEMETRY.SPAN_OPEN_REPORT}_${iouReportID}`, {
name: 'MoneyRequestReportPreviewContent',
op: CONST.TELEMETRY.SPAN_OPEN_REPORT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
import useTransactionViolations from '@hooks/useTransactionViolations';
import Performance from '@libs/Performance';
import {getIOUActionForReportID, isSplitBillAction as isSplitBillActionReportActionsUtils, isTrackExpenseAction as isTrackExpenseActionReportActionsUtils} from '@libs/ReportActionsUtils';
import {isIOUReport} from '@libs/ReportUtils';
import {startSpan} from '@libs/telemetry/activeSpans';
Expand Down Expand Up @@ -104,7 +103,6 @@ function MoneyRequestReportPreview({
return;
}

Performance.markStart(CONST.TIMING.OPEN_REPORT_FROM_PREVIEW);
startSpan(`${CONST.TELEMETRY.SPAN_OPEN_REPORT}_${iouReportID}`, {
name: 'MoneyRequestReportPreview',
op: CONST.TELEMETRY.SPAN_OPEN_REPORT,
Expand Down
9 changes: 0 additions & 9 deletions src/components/Search/SearchAutocompleteList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import type {Options, SearchOption} from '@libs/OptionsListUtils';
import {combineOrderingOfReportsAndPersonalDetails, getSearchOptions} from '@libs/OptionsListUtils';
import Parser from '@libs/Parser';
import Performance from '@libs/Performance';
import {getAllTaxRates, getCleanedTagName, shouldShowPolicy} from '@libs/PolicyUtils';
import {getReportAction} from '@libs/ReportActionsUtils';
import type {OptionData} from '@libs/ReportUtils';
Expand Down Expand Up @@ -115,7 +114,6 @@
};

const setPerformanceTimersEnd = () => {
Performance.markEnd(CONST.TIMING.OPEN_SEARCH);
endSpan(CONST.TELEMETRY.SPAN_OPEN_SEARCH_ROUTER);
};

Expand Down Expand Up @@ -693,7 +691,6 @@
const actionId = `filter_options_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
const startTime = Date.now();

Performance.markStart(CONST.TIMING.SEARCH_FILTER_OPTIONS);
Log.info('[CMD_K_DEBUG] Filter options started', false, {
actionId,
queryLength: autocompleteQueryValue.length,
Expand All @@ -705,7 +702,6 @@
try {
if (autocompleteQueryValue.trim() === '') {
const endTime = Date.now();
Performance.markEnd(CONST.TIMING.SEARCH_FILTER_OPTIONS);
Log.info('[CMD_K_DEBUG] Filter options completed (empty query path)', false, {
actionId,
duration: endTime - startTime,
Expand All @@ -727,7 +723,6 @@

const finalOptions = reportOptions.slice(0, 20);
const endTime = Date.now();
Performance.markEnd(CONST.TIMING.SEARCH_FILTER_OPTIONS);
Log.info('[CMD_K_DEBUG] Filter options completed (search path)', false, {
actionId,
duration: endTime - startTime,
Expand All @@ -741,7 +736,6 @@
return finalOptions;
} catch (error) {
const endTime = Date.now();
Performance.markEnd(CONST.TIMING.SEARCH_FILTER_OPTIONS);
Log.alert('[CMD_K_FREEZE] Filter options failed', {
actionId,
error: String(error),
Expand All @@ -767,7 +761,6 @@
handleSearch(autocompleteQueryWithoutFilters);

const endTime = Date.now();
Performance.markEnd(CONST.TIMING.DEBOUNCE_HANDLE_SEARCH);
Log.info('[CMD_K_DEBUG] Debounced search completed', false, {
actionId,
duration: endTime - startTime,
Expand All @@ -780,7 +773,6 @@
const actionId = `debounce_search_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
const startTime = Date.now();

Performance.markStart(CONST.TIMING.DEBOUNCE_HANDLE_SEARCH);
Log.info('[CMD_K_DEBUG] Debounced search started', false, {
actionId,
queryLength: autocompleteQueryWithoutFilters?.length ?? 0,
Expand All @@ -792,7 +784,6 @@
handleDebouncedSearch(actionId, startTime);
} catch (error) {
const endTime = Date.now();
Performance.markEnd(CONST.TIMING.DEBOUNCE_HANDLE_SEARCH);
Log.alert('[CMD_K_FREEZE] Debounced search failed', {
actionId,
error: String(error),
Expand Down Expand Up @@ -891,7 +882,7 @@
flatIndex++;
}
}
}, [areOptionsInitialized, firstRecentReportKey, shouldUseNarrowLayout]);

Check warning on line 885 in src/components/Search/SearchAutocompleteList.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

React Hook useEffect has a missing dependency: 'sections'. Either include it or remove the dependency array

Check warning on line 885 in src/components/Search/SearchAutocompleteList.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

React Hook useEffect has a missing dependency: 'sections'. Either include it or remove the dependency array

useEffect(() => {
const targetText = autocompleteQueryValue;
Expand Down
2 changes: 0 additions & 2 deletions src/components/Search/SearchRouter/SearchButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import Performance from '@libs/Performance';
import {startSpan} from '@libs/telemetry/activeSpans';
import {callFunctionIfActionIsAllowed} from '@userActions/Session';
import CONST from '@src/CONST';
Expand All @@ -30,7 +29,6 @@ function SearchButton({style, shouldUseAutoHitSlop = false}: SearchButtonProps)
callFunctionIfActionIsAllowed(() => {
pressableRef.current?.blur();

Performance.markStart(CONST.TIMING.OPEN_SEARCH);
startSpan(CONST.TELEMETRY.SPAN_OPEN_SEARCH_ROUTER, {
name: CONST.TELEMETRY.SPAN_OPEN_SEARCH_ROUTER,
op: CONST.TELEMETRY.SPAN_OPEN_SEARCH_ROUTER,
Expand Down
2 changes: 0 additions & 2 deletions src/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import {canUseTouchScreen} from '@libs/DeviceCapabilities';
import Log from '@libs/Log';
import isSearchTopmostFullScreenRoute from '@libs/Navigation/helpers/isSearchTopmostFullScreenRoute';
import type {PlatformStackNavigationProp} from '@libs/Navigation/PlatformStackNavigation/types';
import Performance from '@libs/Performance';
import {isSplitAction} from '@libs/ReportSecondaryActionUtils';
import {canEditFieldOfMoneyRequest, canHoldUnholdReportAction, canRejectReportAction, isOneTransactionReport, selectFilteredReportActions} from '@libs/ReportUtils';
import {buildCannedSearchQuery, buildSearchQueryString} from '@libs/SearchQueryUtils';
Expand Down Expand Up @@ -951,7 +950,6 @@ function Search({
return;
}

Performance.markStart(CONST.TIMING.OPEN_REPORT_SEARCH);
startSpan(`${CONST.TELEMETRY.SPAN_OPEN_REPORT}_${reportID}`, {
name: 'Search',
op: CONST.TELEMETRY.SPAN_OPEN_REPORT,
Expand Down
2 changes: 0 additions & 2 deletions src/libs/IOUUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import SafeString from '@src/utils/SafeString';
import type {IOURequestType} from './actions/IOU';
import {getCurrencyUnit} from './CurrencyUtils';
import Navigation from './Navigation/Navigation';
import Performance from './Performance';
import {isPaidGroupPolicy} from './PolicyUtils';
import {getReportTransactions} from './ReportUtils';
import {getCurrency, getTagArrayFromName} from './TransactionUtils';
Expand Down Expand Up @@ -49,7 +48,6 @@ function navigateToStartMoneyRequestStep(requestType: IOURequestType, iouType: I
}

function navigateToParticipantPage(iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string) {
Performance.markStart(CONST.TIMING.OPEN_CREATE_EXPENSE_CONTACT);
switch (iouType) {
case CONST.IOU.TYPE.REQUEST:
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_PARTICIPANTS.getRoute(CONST.IOU.TYPE.SUBMIT, transactionID, reportID));
Expand Down
9 changes: 0 additions & 9 deletions src/libs/Metrics/index.native.ts

This file was deleted.

6 changes: 0 additions & 6 deletions src/libs/Metrics/index.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/libs/Metrics/types.ts

This file was deleted.

Loading
Loading