diff --git a/loc/en.json b/loc/en.json index 852bab064..003bbbab4 100644 --- a/loc/en.json +++ b/loc/en.json @@ -211,6 +211,8 @@ "about_license": "MIT License", "about_release_notes": "Release notes", "about_review": "Leave us a review", + "performance_score": "Performance score: {num}", + "run_performance_test": "Test performance", "about_selftest": "Run self-test", "about_selftest_electrum_disabled": "Self-testing is not available with Electrum Offline Mode. Please disable offline mode and try again.", "about_selftest_ok": "All internal tests have passed successfully. The wallet works well.", diff --git a/screen/settings/about.js b/screen/settings/about.js index 8190af172..47ce0607c 100644 --- a/screen/settings/about.js +++ b/screen/settings/about.js @@ -1,5 +1,5 @@ import React, { useContext } from 'react'; -import { TouchableOpacity, ScrollView, Linking, Image, View, Text, StyleSheet, useWindowDimensions, Platform } from 'react-native'; +import { TouchableOpacity, ScrollView, Linking, Image, View, Text, StyleSheet, useWindowDimensions, Platform, Alert } from 'react-native'; import { useNavigation, useTheme } from '@react-navigation/native'; import { Icon } from 'react-native-elements'; import { getApplicationName, getVersion, getBundleId, getBuildNumber, getUniqueId, hasGmsSync } from 'react-native-device-info'; @@ -10,6 +10,7 @@ import loc, { formatStringAddTwoWhiteSpaces } from '../../loc'; import Clipboard from '@react-native-clipboard/clipboard'; import { BlueStorageContext } from '../../blue_modules/storage-context'; import alert from '../../components/Alert'; +import { HDSegwitBech32Wallet } from '../../class'; const A = require('../../blue_modules/analytics'); const branch = require('../../current-branch.json'); @@ -208,6 +209,31 @@ const About = () => { testID="RunSelfTestButton" title={loc.settings.about_selftest} /> + { + const secret = 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about'; + const w = new HDSegwitBech32Wallet(); + w.setSecret(secret); + + const start = Date.now(); + let num; + for (num = 0; num < 1000; num++) { + w._getExternalAddressByIndex(num); + if (Date.now() - start > 10 * 1000) { + break; + } + } + + Alert.alert(loc.formatString(loc.settings.performance_score, { num })); + }} + title={loc.settings.run_performance_test} + />