-
-
Notifications
You must be signed in to change notification settings - Fork 279
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
How profound is the DB implementation #470
Comments
I suspect another use case (perhaps more realistic) would be to run the app as a mobile web app for users that don't want to install it as a native app. On the web site it's probably not practical to run the whole app, but instead pick the components that make sense, e.g. to provide a common product info view. |
The database is accessed only through In my own app I really enjoyed using the code (99%) for Android, iOS and web app. If the question is: "Should we build a different smaller flutter web app from smoothie?", I don't really see the point, we might as well start a new web project with web components. I'll have a look at sqlite for flutter web. @M123-dev @zond I'm not sure I fully understood what you're worried about: is that 1) that smoothie uses a sqlite database and therefore doesn't work in web for the moment or 2) that smoothie is too complex for a web app? |
Thanks @monsieurtanuki , for me it was more point 1 since a large part of the features are currently dependent on the database, I was unsure whether it would be worth making it web-compatible or if it would be too much effort. |
@M123-dev Let's say that for the moment the web app is not part of the plan AFAIK, and that we're still trying to figure out what the (Android+iOS) app will be. For instance, we could easily store all products in PS: but with the use of |
@M123-dev Correction: from what I understood,
|
@monsieurtanuki , what about hive? There you split your data into different named boxes. From how the dart code is structured I would think that the data is loaded into memory when the box is opened. It's very likely not comparable to sqflite, but i think we should focus more on lists and not necessarily on caching in the web. |
@M123-dev I don't think
To be benchmarked if needed. |
@M123-dev Reading further about That probably means that:
I think a benchmark would then make sense - I'll reuse the one I coded around |
I've just run tests with
As I suspected the main problem with
Which gives us 1.361 ms per product for a box, 0.843 ms per product for a lazy box. Regarding the file size, the hive version is slightly smaller (106Mb instead of 123Mb for sqflite) (10K products) Regarding data bulk insert performance, the hive version is twice faster (2500 ms instead of 6000 ms) when inserting 1000 products. An optimization for hive could be to use separate "partitioned" boxes for products. Conclusion - as I said before, the main question is "what are we going to use the database for?":
|
@monsieurtanuki thanks for the information. I am a fan of caching as such but I think with this performance we might not need caching on the web at all. The benchmarks you gave seemed rather daunting and I don't think it bringt that much of an advantage to the potential web users. If I'm right, it shouldn't be that much extra work to check the platform in the Dao classes and some smaller things like the search history could be quickly rebuild with hive or maybe even sharedPreferences. |
Hi @M123-dev! I've just tested I do think it could be interesting to switch both SharedPreferences and sqflite to hive, and as already mentioned that could be painless because restricted to It's also possible to implement different
A solution could be to specify how many products we want to cache (in the history cache). Interesting issue, I'm willing to work on it, but first I need more feedbacks about the planned uses of the database and the relevancy of a flutter web app. @stephanegigandet @teolemon ? |
From @jasmeet0817's comment ("the concepts of user defined lists, shopping lists and pantries are discarded") I see that most of the database complexity can be removed. That's would be a good opportunity to switch to
@jasmeet0817 @M123-dev Your opinion on that? |
Hi, Hive looks secure and easy, I just have a couple devil's advocate questions.
|
Good questions. My answers:
|
Yes I think that is a good idea, since the list feature is (unfortunately) no longer provided it can probably really save a lot of code and even if we later need parts of the current SQFlite code for offline scanning or some kind of lists for something we can thanks to git always reach back to this state and grab some code. |
Yeah, I also agree it's a good idea to go with Hive |
Working on it... |
Yes, we don't need a migration, but we should delete the old data so that we don't have it stumbling around on the phone forever. |
@M123-dev Just uninstall the app then: I won't keep |
Ok, then let's remove sqflite completely, I won't miss the few kb extra |
…es and colors Deleted files: * `bulk_deletable.dart` * `bulk_insertable.dart` * `bulk_manager.dart` * `dao_product_extra.dart` * `label_sneek_peak_view.dart` * `list_page.dart` * `multi_product_select_page.dart` * `product_copy_helper.dart` * `product_copy_view.dart` * `product_extra.dart` * `product_list_add_button.dart` * `product_list_button.dart` * `product_list_item.dart` * `product_list_item_pantry.dart` * `product_list_item_shopping.dart` * `product_list_preview.dart` * `product_list_preview_helper.dart` Impacted files: * `abstract_dao.dart`: added hive related init methods * `barcode_product_query.dart`: minor refactoring * `category_product_query.dart`: minor refactoring * `continuous_scan_model.dart`: minor refactoring * `dao_product.dart`: rewritten from scratch with hive instead of sqflite - much easier to understand! * `dao_product_list.dart`: rewritten from scratch with hive instead of sqflite - much easier to understand! * `dao_string_list.dart` (renamed from `search_history.dart`): rewritten from scratch with hive instead of sqflite * `database_product_list_supplier.dart`: minor refactoring * `group_product_query.dart`: minor refactoring * `history_page.dart`: minor refactoring * `keywords_product_query.dart`: minor refactoring * `local_database.dart`: rewritten from scratch with hive instead of sqflite; simplified * `main.dart`: minor refactoring * `new_product_page.dart`: minor refactoring * `personalized_ranking_page.dart`: removed old feature * `product_list.dart`: preferred `enum` to `String` for types; removed tons of old features * `product_list_dialog_helper.dart`: removed old feature * `product_list_item_simple.dart`: removed old features * `product_list_page.dart`: removed old features * `product_page.dart`: removed old feature * `product_query_page_helper.dart`: cleaner code with `enum`s * `pubspec.yaml`: added hive, removed sqflite * `query_product_list_supplier.dart`: minor refactoring * `search_history_view.dart`: minor refactoring * `search_page.dart`: minor refactoring
Impacted files: * `dao_product_list.dart` * `local_database.dart`
…#717) Deleted files: * `bulk_deletable.dart` * `bulk_insertable.dart` * `bulk_manager.dart` * `dao_product_extra.dart` * `label_sneek_peak_view.dart` * `list_page.dart` * `multi_product_select_page.dart` * `product_copy_helper.dart` * `product_copy_view.dart` * `product_extra.dart` * `product_list_add_button.dart` * `product_list_button.dart` * `product_list_item.dart` * `product_list_item_pantry.dart` * `product_list_item_shopping.dart` * `product_list_preview.dart` * `product_list_preview_helper.dart` Impacted files: * `abstract_dao.dart`: added hive related init methods * `barcode_product_query.dart`: minor refactoring * `category_product_query.dart`: minor refactoring * `continuous_scan_model.dart`: minor refactoring * `dao_product.dart`: rewritten from scratch with hive instead of sqflite - much easier to understand! * `dao_product_list.dart`: rewritten from scratch with hive instead of sqflite - much easier to understand! * `dao_string_list.dart` (renamed from `search_history.dart`): rewritten from scratch with hive instead of sqflite * `database_product_list_supplier.dart`: minor refactoring * `group_product_query.dart`: minor refactoring * `history_page.dart`: minor refactoring * `keywords_product_query.dart`: minor refactoring * `local_database.dart`: rewritten from scratch with hive instead of sqflite; simplified * `main.dart`: minor refactoring * `new_product_page.dart`: minor refactoring * `personalized_ranking_page.dart`: removed old feature * `product_list.dart`: preferred `enum` to `String` for types; removed tons of old features * `product_list_dialog_helper.dart`: removed old feature * `product_list_item_simple.dart`: removed old features * `product_list_page.dart`: removed old features * `product_page.dart`: removed old feature * `product_query_page_helper.dart`: cleaner code with `enum`s * `pubspec.yaml`: added hive, removed sqflite * `query_product_list_supplier.dart`: minor refactoring * `search_history_view.dart`: minor refactoring * `search_page.dart`: minor refactoring
@monsieurtanuki there is the idea of implementing some parts or even the whole app, inside the website.
The question is how deeply is the DB integrated in the code, can we for example allow to show the product page on web and exclude the caching and adding to history lists.
And is it worth the effort?
CC: @zond @stephanegigandet
The text was updated successfully, but these errors were encountered: