Skip to content

Store prefix lenght to private property _prefixLenght#71

Merged
jsakamoto merged 2 commits intojsakamoto:masterfrom
KamilZm:master
Mar 9, 2021
Merged

Store prefix lenght to private property _prefixLenght#71
jsakamoto merged 2 commits intojsakamoto:masterfrom
KamilZm:master

Conversation

@KamilZm
Copy link
Contributor

@KamilZm KamilZm commented Mar 7, 2021

GetPrefixLength() is very expensive method. If you call it many times (I have to +-1000000 calls), it will take a very long time.
I store prefix lenght to private property _prefixLenght in order to optimise multiple calls GetPrefixLength().

Number of calls: 1000000
Without optimalisation 14635 ms
With optimalisation: 4 ms

@jsakamoto
Copy link
Owner

@KamilZm Thank you for your contribution! 👍

I'll merge this pull request.

By the way, these changes are also safe for the case that rewriting the public setter properties of Begin and End?

see also: #68

Fix the typing error in "_prefixLenght"
@KamilZm
Copy link
Contributor Author

KamilZm commented Mar 8, 2021

@jsakamoto Thank you, good point, you are right. I have fixed it.

PS: I'm sorry for my English

@jsakamoto
Copy link
Owner

@KamilZm Thank you for your effort!

I'll merge this pull request as soon as possible, and I'll publish a new version of this package.
Thanks again!

P.S.

I'm sorry for my English

Don't mind! I'm also a not-native English speaker. 😄

@jsakamoto jsakamoto merged commit e2e19a4 into jsakamoto:master Mar 9, 2021
@jsakamoto
Copy link
Owner

@KamilZm

I merged your pull request just now, and I published the new version of this package! 🎉

Again, thank you for your contribution! 👍

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.

2 participants