Skip to content

Regex is too slow on larger datasets #1

Description

@Faheetah

Search is incredibly slow due to a hack to better improve results, however this results in MANY calls to Elixir.Regex. This is from making a call to regex to coerce entries to a-zA-Z in each iteration over the entire ETS table. Given that there could be hundreds or thousands of results for common words, this means a LOT of regex calls. Best approach would be to maybe store the references of all other terms in the row. An alternative would be to just, instead of brute forcing through all terms, just find the items that have one term then find if they have any of the other terms, however that can balloon the algorithm too and is prone to less accurate results.

lists:reverse/2                                                  50012     0.35    24761  [      0.50]
re:loopexec/8                                                    57120     0.53    36889  [      0.65]
'Elixir.Enum':reject_list/2                                      97952     0.55    38344  [      0.39]
'Elixir.String.Unicode':next_extend_size/3                      278293     0.71    49964  [      0.18]
'Elixir.String.Unicode':next_grapheme_size/1                    283767     0.81    56851  [      0.20]
'Elixir.String.Casing':downcase/3                               262252     0.87    60472  [      0.23]
'Elixir.String.Unicode':do_length/2                             283767     1.07    74678  [      0.26]
'Elixir.Enum':'-map/2-lists^map/1-0-'/2                         201381     1.23    85966  [      0.43]
re:internal_run/4                                                57120     1.75   122024  [      2.14]
'Elixir.Inflex.Pluralize':'-find_in_set/2-fun-0-'/2            1673442     3.54   247315  [      0.15]
erlang:system_info/1                                           1682989     4.14   289556  [      0.17]
re:version/0                                                   1682989     5.29   370049  [      0.22]
'Elixir.Enum':find_list/3                                      1712739     7.56   528417  [      0.31]
'Elixir.Regex':version/0                                       1682989    10.20   712941  [      0.42]
'Elixir.Regex':'match?'/2                                      1673442    10.98   767354  [      0.46]
'Elixir.Regex':safe_run/3                                      1682989    11.34   792677  [      0.47]
re:run/3                                                       1682989    31.06  2171234  [      1.29]
------------------------------------------------------------  --------  -------  -------  [----------]
Total:                                                        16911309  100.00%  6989871  [      0.41]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions