Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MVCNameCase improvements #437

Merged
merged 4 commits into from
Oct 17, 2020

Conversation

joaoduarte19
Copy link
Collaborator

I added a new type of name case serialization: ncSnakeCase

I saw that there was already a conversion function for the snake case, however it failed to convert multiple underscores to just one. So I switched to regular expression conversion.

Original SnakeCase
OneTwo one_two
One__Two one_two
_OneTwo _one_two

@joaoduarte19
Copy link
Collaborator Author

Did you measured the timing of this new version?

I did a quick test and behaved well. But I can put together a test with a large serialization list to find out how it will perform.

@danieleteti
Copy link
Owner

danieleteti commented Oct 16, 2020 via email

…regex, serialization becomes 6 times slower.
@joaoduarte19
Copy link
Collaborator Author

I did a serialization test with an extensive list. I found that using the SnakeCase function with regular expression is about 6 times slower. So, I improved the existing SnakeCase function to convert multiple underscores into just one and also add an underscore between word and numeral.

Original SnakeCase
OneTwo one_two
One__Two one_two
OneTwo03 one_two_03

@joaoduarte19
Copy link
Collaborator Author

When improving unit tests I identified the error described in issue #436 and made the correction.

@joaoduarte19 joaoduarte19 changed the title MVCNameCase snake_case MVCNameCase improvements Oct 17, 2020
@danieleteti
Copy link
Owner

Good! Thank you Joao. RegEx are powerful but quite slow compared in these cases.

@danieleteti danieleteti merged commit 55f6a7d into danieleteti:master Oct 17, 2020
@joaoduarte19 joaoduarte19 deleted the serialize_snake_case branch October 17, 2020 10:49
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.

None yet

2 participants