Skip to content

Conversation

MikeECunningham
Copy link

@MikeECunningham MikeECunningham commented Apr 20, 2022

Change the table's predicate filter to iterate through the map's array of values and check for filter inclusion. This will involve fewer passes: the current function iterates over the keys, searches the map for each key to construct a string, then searches the string. It will also remove the risk presented by the unicode delimiter.
It will also present an improvement over @daniel-brenot's PR which, similarly to the original function, iterates over the keys and then searches the map for their corresponding value. This check is superfluous when an array of values is available.
Performance-wise, a further gain in speed is present over both previous techniques. I have updated Daniel's benchmark script to include the new function, as well as some logic to print results for veracity, check failure performance, and populate a map with n generated UUIDs to help examine performance at scale.
https://jsbench.me/9bl258ffo3/2
At 1,000 entries, the original function is ~80% slower, Daniel's is ~42% slower at successes.
Failures are roughly 65%, 39% slower, respectively.
At 10,000 entries, successes are roughly 84%, 32% slower.
Failures at 10k are roughly 75%, 24% slower.
For completeness, at 10 entries, successes: 63, 11, failures: 55, 9.

@MikeECunningham MikeECunningham marked this pull request as draft April 20, 2022 05:09
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators May 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant