Android Question What is faster or better ... maps or sqlite database?

cheveguerra

Member
Licensed User
Longtime User
Hi everybody,
I have an app that reads notifications and stores the info, and depending on the notification reads or processes and return some parts of the previous notifications.

Right now I am storing the info in maps and lists because I "think" it is faster when processing and accessing it, but I was wondering if it would be better to store the info in a sqlite database and read the info from there every time I need it.

So instead of searching a map or a list for some info, I could do a query to the database ...

What do you think would be better??

Best regards.
 

Sandman

Expert
Licensed User
Longtime User
Considering you're working with notifications, I imagine it's not a lot of data. I mean, it's probably less than 1000 items, right?

In that case you can ignore all aspects of speed - whatever you use will feel instant to the user.

What you have left is mostly this question:

"Do I want the data to be available next time the app starts?"
Yes: Store in database
No: Do whatever you feel like
 
Upvote 0

cheveguerra

Member
Licensed User
Longtime User
Thank you both @Erel and @Sandman ,

No, I am storing a LOT LESS than a million items , and yes probably less than 1000 items, so I just have to decide If I want to keep the data between starts!!

Thank you and best regards
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
You can use both...

but if you wanna search something fast read the data (at the start of app) from database and search in map...

as I remember in old threads Erel suggest that this was the Faster from all:

B4X:
amap.ContainsKey("searchfortext")

I am already using that... in some apps... is extremely fast !!!
 
Upvote 0

cheveguerra

Member
Licensed User
Longtime User
Yes, that's a very good option, thanks for the tip!! ?

Best regards
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…