Skip to content

Conversation

@SystemKeeper
Copy link

Performance before
MM: 104.511237791 seconds
MM: 104.49352295899999 seconds
MM: 105.008809959 seconds

Performance after
MM: 0.34015025 seconds
MM: 0.331338208 seconds
MM: 0.351607875 seconds

Code for performance test

func testTime() throws {
        let clock = ContinuousClock()
        let parser = getParser()

        let result = clock.measure {
            for _ in 0 ..< 100
            {
                _ = parser.parse("""
```
                             Name              Application ID               Version                  Branch      Installation
                             AnyDesk           com.anydesk.Anydesk          6.4.0                    stable      user
                             draw.io           com.jgraph.drawio.desktop    26.0.4                   stable      user
                             Nextcloud Desktop …oud.desktopclient.nextcloud 3.15.3                   stable      user
                             0 A.D.            com.play0ad.zeroad           0.0.26                   stable      user
                             Visual Studio Co… com.visualstudio.code        1.96.4                   stable      user
                             Floorp            one.ablaze.floorp            11.23.0                  stable      user
                             Freedesktop Plat… org.freedesktop.Platform     freedesktop-sdk-22.08.27 22.08       user
                             Freedesktop Plat… org.freedesktop.Platform     freedesktop-sdk-24.08.11 24.08       user
                             Mesa              …desktop.Platform.GL.default 24.0.9                   22.08       user
                             Mesa (Extra)      …desktop.Platform.GL.default 24.0.9                   22.08-extra user
                             Mesa              …desktop.Platform.GL.default 24.3.1                   23.08       user
                             Mesa (Extra)      …desktop.Platform.GL.default 24.3.1                   23.08-extra user
                             Mesa              …desktop.Platform.GL.default 24.3.4                   24.08       user
                             Mesa (Extra)      …desktop.Platform.GL.default 24.3.4                   24.08extra  user
                             Intel             …esktop.Platform.VAAPI.Intel                          22.08       user
                             Intel VAAPI driv… …esktop.Platform.VAAPI.Intel                          23.08       user
                             Intel VAAPI driv… …esktop.Platform.VAAPI.Intel                          24.08       user
                             FFmpeg extension… …esktop.Platform.ffmpeg-full                          24.08       user
                             openh264          …eedesktop.Platform.openh264 2.1.0                    2.2.0       user
                             openh264          …eedesktop.Platform.openh264 2.4.1                    2.4.1       user
                             Freedesktop SDK   org.freedesktop.Sdk          freedesktop-sdk-22.08.27 22.08       user
                             Freedesktop SDK   org.freedesktop.Sdk          freedesktop-sdk-23.08.27 23.08       user
                             Freedesktop SDK   org.freedesktop.Sdk          freedesktop-sdk-24.08.10 24.08       user
                             Evolution         org.gnome.Evolution          3.54.3                   stable      user
                             GNOME Applicatio… org.gnome.Platform                                    47          user
                             Pop Gtk theme     org.gtk.Gtk3theme.Pop-dark                            3.22        user
                             KDE Application … org.kde.Platform                                      5.15-24.08  user
                             KDE Application … org.kde.Platform                                      6.7         user
                             KDE Application … org.kde.Platform                                      6.8         user
                             QGnomePlatform    …latformTheme.QGnomePlatform                          5.15-24.08  user
                             QAdwaitaDecorati… …oration.QAdwaitaDecorations                          5.15-24.08  user
                             QAdwaitaDecorati… …oration.QAdwaitaDecorations                          6.7         user
                             KeePassXC         org.keepassxc.KeePassXC      2.7.9                    stable      user
                             Signal Desktop    org.signal.Signal            7.41.0                   stable      user
                             Wireshark         org.wireshark.Wireshark      4.4.3                    stable      user
""")
            }
        }

        print("MM: \(result)")
    }

(note the non-closing three-backticks)

How to test manually

  1. Post the following message

    ```
                              Name              Application ID               Version                  Branch      Installation
                              AnyDesk           com.anydesk.Anydesk          6.4.0                    stable      user
                              draw.io           com.jgraph.drawio.desktop    26.0.4                   stable      user
                              Nextcloud Desktop …oud.desktopclient.nextcloud 3.15.3                   stable      user
                              0 A.D.            com.play0ad.zeroad           0.0.26                   stable      user
                              Visual Studio Co… com.visualstudio.code        1.96.4                   stable      user
                              Floorp            one.ablaze.floorp            11.23.0                  stable      user
                              Freedesktop Plat… org.freedesktop.Platform     freedesktop-sdk-22.08.27 22.08       user
                              Freedesktop Plat… org.freedesktop.Platform     freedesktop-sdk-24.08.11 24.08       user
                              Mesa              …desktop.Platform.GL.default 24.0.9                   22.08       user
                              Mesa (Extra)      …desktop.Platform.GL.default 24.0.9                   22.08-extra user
                              Mesa              …desktop.Platform.GL.default 24.3.1                   23.08       user
                              Mesa (Extra)      …desktop.Platform.GL.default 24.3.1                   23.08-extra user
                              Mesa              …desktop.Platform.GL.default 24.3.4                   24.08       user
                              Mesa (Extra)      …desktop.Platform.GL.default 24.3.4                   24.08extra  user
                              Intel             …esktop.Platform.VAAPI.Intel                          22.08       user
                              Intel VAAPI driv… …esktop.Platform.VAAPI.Intel                          23.08       user
                              Intel VAAPI driv… …esktop.Platform.VAAPI.Intel                          24.08       user
                              FFmpeg extension… …esktop.Platform.ffmpeg-full                          24.08       user
                              openh264          …eedesktop.Platform.openh264 2.1.0                    2.2.0       user
                              openh264          …eedesktop.Platform.openh264 2.4.1                    2.4.1       user
                              Freedesktop SDK   org.freedesktop.Sdk          freedesktop-sdk-22.08.27 22.08       user
                              Freedesktop SDK   org.freedesktop.Sdk          freedesktop-sdk-23.08.27 23.08       user
                              Freedesktop SDK   org.freedesktop.Sdk          freedesktop-sdk-24.08.10 24.08       user
                              Evolution         org.gnome.Evolution          3.54.3                   stable      user
                              GNOME Applicatio… org.gnome.Platform                                    47          user
                              Pop Gtk theme     org.gtk.Gtk3theme.Pop-dark                            3.22        user
                              KDE Application … org.kde.Platform                                      5.15-24.08  user
                              KDE Application … org.kde.Platform                                      6.7         user
                              KDE Application … org.kde.Platform                                      6.8         user
                              QGnomePlatform    …latformTheme.QGnomePlatform                          5.15-24.08  user
                              QAdwaitaDecorati… …oration.QAdwaitaDecorations                          5.15-24.08  user
                              QAdwaitaDecorati… …oration.QAdwaitaDecorations                          6.7         user
                              KeePassXC         org.keepassxc.KeePassXC      2.7.9                    stable      user
                              Signal Desktop    org.signal.Signal            7.41.0                   stable      user
                              Wireshark         org.wireshark.Wireshark      4.4.3                    stable      user
    
  2. Try to scroll the conversation list, when this message is the last message (it hangs)

  3. Try to enter a conversation with that message (it shows a spinner while opening the conversation)

Info on catastrophic backtracking: https://www.regular-expressions.info/possessive.html

@SystemKeeper SystemKeeper requested a review from Ivansss February 25, 2025 10:12
@SystemKeeper SystemKeeper marked this pull request as draft February 25, 2025 12:24
Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
@SystemKeeper SystemKeeper force-pushed the fix/noid/code-escaping-performance branch from 679816e to e3549eb Compare February 25, 2025 12:32
@SystemKeeper SystemKeeper marked this pull request as ready for review February 25, 2025 12:33
@SystemKeeper
Copy link
Author

Missed the non-greedy quantifier 😓 Added a test for that.

@Ivansss Ivansss merged commit 60c7cf1 into master Feb 25, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants