-
Notifications
You must be signed in to change notification settings - Fork 236
Replace emoji parser library #1442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
@Fs00 Please give this a try as well. |
|
Were you following the development of that library too? 😄 Don't forget to update the used libraries in the Readme and in About screen of the app 😉 |
|
Rebase done.
Good point, thanks. |
emoji-java is unmaintained since 2019, so replace it with a library that receives updates.
|
I've played a bit with it and the emoji parsing behaves more faithfully to the GitHub website, which is a great plus. I'd suggest checking with the library author if something can be done on their side to improve the situation. |
So far, I just tested on the emulator. I now gave this a try on my phone (Pixel 8), and it looks fine there as well, taking 200ms ... but admittedly the phone is quite a bit faster than Xperia X Compact. Let's see what the author's response to this is: felldo/JEmoji#57 |
|
@Fs00 What does this diff do to the loading times on your device? diff --git a/app/src/main/java/com/gh4a/Gh4Application.java b/app/src/main/java/com/gh4a/Gh4Application.java
index 1f2738e8..0ab4a27c 100644
--- a/app/src/main/java/com/gh4a/Gh4Application.java
+++ b/app/src/main/java/com/gh4a/Gh4Application.java
@@ -29,6 +29,8 @@ import com.gh4a.worker.NotificationsWorker;
import com.meisolsson.githubsdk.model.User;
import com.tspoon.traceur.Traceur;
·
+import net.fellbaum.jemoji.EmojiManager;
+
import org.ocpsoft.prettytime.PrettyTime;
·
import java.util.HashSet;
@@ -67,6 +69,7 @@ public class Gh4Application extends Application implements
super.onCreate();
·
sInstance = this;
+ new Thread(() -> EmojiManager.getEmoji("")).start();
·
SharedPreferences prefs = getPrefs();
·BTW, API 24 emulator seems quite a bit slower than API 34 emulator, so the issue likely is in the optimization of the static initializer. |
|
@Fs00 And for another test, please try whether updating to 1.7.1 (instead of the thread approach) helps. |
|
1.7.1 improves loading times significantly, but not enough not to be noticeable on older devices.
However, replacing the line you suggested above with the following one: new Thread(() -> EmojiManager.replaceAliases("", (p1, p2) -> "")).start();pretty much prevents freezes to occur even on old devices. This helps even when the app starts directly on a screen that uses |
|
I've just tested 1.7.2 but it crashes: |
|
Hi @Fs00 , I am the author of the library. I have no idea why this is happening. All tests passed and when using the library in a Java 17 project it also works flawless (the newly released version on maven central). Maybe this is an android related issue again? |
|
Hello @felldo, I've tested the attached JAR and it didn't crash anymore, but loading times are massively slower than v1.7.1. |
Very weird problem which I don't know why it happens. Now it should deserialize a java object instead of initializing 100+ interfaces which I suspected to be the problem (Though a bit of a performance degradation is exptected in comparison to emoji-java, as JEmoji is far superior in terms of available data for emojis and including the newest emojis). |
|
So, I found some old phones and could test the library myself and do a bit of research. I got these results: Samsung Galaxy S7 Edge
Samsung Galaxy S4:
There are now some significant improvements by simply using a BufferedInpuStream. So the used InputStream to read the emoji file seems to be the bottleneck. I guess we are now back to the "original" improved time of 1.5s on your Samsung Galaxy A3 2017 or maybe even a bit better. If you want to test it with your phone again, I attached the improved library code below, otherwise I am going to publish a new version soon. |
|
Can confirm that the new build improves things a lot, loading performance is now the same as 1.7.1. Since we've seen that preloading emojis upfront is required to avoid stutters on older phones, could the library expose a few functions for explicitly initializing the required emoji data? So that we could call something like |
|
The "slow" part of the library (reading the emoji data) is triggered by calling any method in the EmojiManager. |

emoji-java is unmaintained since 2019, so replace it with a library that receives updates.