Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Improve camelize performance #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

mcamis
Copy link

@mcamis mcamis commented Jul 20, 2021

I've been building an app for low spec platforms that uses humps to normalize API responses. I noticed that the camelizeKeys function was taking nearly hundreds of ms to complete due to Symbol.replace. Switching to an iteration-based approach to format the string cut the function time down by more than half for each API call in the app.

Before:
Screen Shot 2021-07-20 at 12 35 17 PM

After:
Screen Shot 2021-07-20 at 12 40 55 PM

@jkonowitch
Copy link

@domchristie great performance improvement here - can this be main lined?

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.

2 participants