CharrafiMed / global-search-modal

Enhances filamentphp's global search by transforming it into a modal for a better user experience
https://filamentphp.com/plugins/charrafimed-global-search-modal
84 stars 19 forks source link

Since upgrade from 3.1 to 3.3 very slow #56

Closed theAusMenace closed 2 months ago

theAusMenace commented 2 months ago

Hi and thanks for making this plugin. I tip my hat to you sir.

Latest Laravel Latest Filament php 8.3 fpm / nginx (latest)

Since upgrading, everything runs VERY SLOW - disable plugin PanelProvider, all back to normal. I have copies of same project with 3.1 and 3.3 and 3.1 project no issues.

Not sure what other information I can provide.

Using debugbar response time for page is quick (200-300ms) although the page can take 5 seconds IRL, however, I believe something going on with SQL in background, all queries slow.

CharrafiMed commented 2 months ago

Hey @theAusMenace, thank you.

Could you please share how you're using the plugin in your resources? In version 3.3, I made some optimizations, and a slowdown is unexpected, so this behavior seems a bit unusual. I'd like to dig deeper and figure out what might be causing this.

theAusMenace commented 2 months ago

Thankyou for looking into this.

Below are code snippets used in my project.

filament 3.2.114

PanelProvider

->plugins([
    GlobalSearchModalPlugin::make()
])

There are 6 Resources with similar GlobalSearch code. Resource

public static function getGloballySearchableAttributes(): array
  {
      return ['name'];
  }

public static function getGlobalSearchResultTitle(Model $record): string
    {
        return substr($record->name, 0, 32);
    }

    public static function getGlobalSearchResultDetails(Model $record): array
    {
        return [
            'Name' => $record->name,
            'Type' => $record->type,
        ];
    }

    public static function getGlobalSearchResultUrl(Model $record): string
    {
        return CarrierResource::getUrl('view', ['record' => $record]);
    }
theAusMenace commented 2 months ago

PS SQL Server details - cPanel hosted (version out of my control) in my AppServiceProvider I have

Schema::defaultStringLength(191);

to accomodate older version.

App is hosted on another server Ubuntu / nginx / php 8.3 all latest stable

Server: Localhost via UNIX socket Server type: MariaDB Server connection: SSL is not being used Documentation Server version: 10.6.19-MariaDB - MariaDB Server Protocol version: 10 Server charset: cp1252 West European (latin1)

CharrafiMed commented 2 months ago

@theAusMenace thank you everything seems to be normal in your usage of the plugin so there is something that I don't know need to change
Could you please confirm whether version 3.3 works seamlessly within the same project where you previously used version 3.1 and everything is normal (based on that you tell me that you have two copies of the code )

theAusMenace commented 2 months ago

Thanks again for looking into this. I can confirm that the performance issue is NOT there in 3.1 - even in the affected app I have updated composer.json "charrafimed/global-search-modal": "3.1", and performance is back to normal. I also tried 3.4, so issue appears 3.1 -> 3.3 Another thing I tried was in my resources, removing / commenting functions getGlobal* which did not fix the performance in case there was some interaction there. so no stress for me at the moment, happy to stick with 3.1 for the moment.