Commit f09d033
committed
Improve performance by extracting windowManager and getRotatedValues()
Once sensor listeners are registered, onSensorChanged() (and subsequently
getRotatedValues()) gets called multiple times per socond. Obtaining
WindowManager on each of those calls is superfluous and can be avoided
by extracting it to a lazy class val. getRotatedValue() can also be
called before checking sensor type, and used for each one of them,
resulting in less code repetition.1 parent 7a42afb commit f09d033
File tree
1 file changed
+15
-20
lines changed- platform/android/java/lib/src/org/godotengine/godot
1 file changed
+15
-20
lines changedLines changed: 15 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
| |||
818 | 821 | | |
819 | 822 | | |
820 | 823 | | |
821 | | - | |
822 | | - | |
823 | | - | |
824 | 824 | | |
825 | | - | |
| 825 | + | |
826 | 826 | | |
827 | 827 | | |
828 | 828 | | |
| |||
851 | 851 | | |
852 | 852 | | |
853 | 853 | | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
854 | 857 | | |
855 | 858 | | |
856 | | - | |
| 859 | + | |
857 | 860 | | |
858 | | - | |
859 | | - | |
860 | | - | |
| 861 | + | |
861 | 862 | | |
862 | 863 | | |
863 | 864 | | |
864 | 865 | | |
865 | | - | |
| 866 | + | |
866 | 867 | | |
867 | | - | |
868 | | - | |
869 | | - | |
| 868 | + | |
870 | 869 | | |
871 | 870 | | |
872 | 871 | | |
873 | 872 | | |
874 | | - | |
| 873 | + | |
875 | 874 | | |
876 | | - | |
877 | | - | |
878 | | - | |
| 875 | + | |
879 | 876 | | |
880 | 877 | | |
881 | 878 | | |
882 | 879 | | |
883 | | - | |
| 880 | + | |
884 | 881 | | |
885 | | - | |
886 | | - | |
887 | | - | |
| 882 | + | |
888 | 883 | | |
889 | 884 | | |
890 | 885 | | |
| |||
0 commit comments