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

Improve the performance of the lib #94

Merged
merged 25 commits into from
May 21, 2022
Merged

Improve the performance of the lib #94

merged 25 commits into from
May 21, 2022

Conversation

InderKumarRathore
Copy link
Owner

@InderKumarRathore InderKumarRathore commented Mar 14, 2021

Reading from plist every time is time consuming. Need to check how much time it takes to get the device name.

The idea to reduce the time are as follows

Save the device info in the user default keeping in mind that newer version of the lib can have updated names, enum etc. and update if there is new version.

Once we have updates info keep it in internal static variable and always return from it. This will reduce the memory imprint and would be much faster if new instance is created. Also will be faster in subsequent launches as the data will be read from user defaults.

Issue: #86

  • Using protocols for DeviceGuru
  • Returning Version object instead of raw string
  • Add Unit tests

Update

I ran the app using new implementation and subsequent launches are 10x faster than older implementation.

Old implementation was taking 10ms to get the info on subsequent calls on average, but new implementation was taking 1ms.
I checked the memory although it was low but not significant compared to the app. The only advantage is that now in new implementation we don't keep plist data(dictionary) in the memory

@InderKumarRathore InderKumarRathore changed the title [WIP] [WIP] Improve the performance of the lib Mar 14, 2021
@InderKumarRathore
Copy link
Owner Author

I ran the app using new library and subsequent launches are 10x faster than older library.

Old library was taking 10ms to get the info on subsequent calls on average, but new library was taking 1ms.
I checked the memory although it was low but not significant compare the app. The only advantage is that now in new library we don't keep plist data(dictionary) in the memory

@InderKumarRathore InderKumarRathore merged commit 9bb934c into master May 21, 2022
@InderKumarRathore InderKumarRathore changed the title [WIP] Improve the performance of the lib Improve the performance of the lib May 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant