suggestions by fasterer
MarcoCostantini opened this issue · 2 comments
MarcoCostantini commented
Improve the code using the suggestions by fasterer (see https://github.com/DamirSvrtan/fasterer)
lib/alexandria/ui/smart_library_properties_dialog_base.rb:281 Using each_with_index is slower than while loop.
lib/alexandria/ui/preferences_dialog.rb:315 Using each_with_index is slower than while loop.
lib/alexandria/ui/new_book_dialog.rb:160 Using each_with_index is slower than while loop.
lib/alexandria/ui/barcode_animation.rb:146 Using each_with_index is slower than while loop.
lib/alexandria/smart_library.rb:331 Calling argumentless methods within blocks is slower than using symbol to proc.
lib/alexandria/import_library_csv.rb:36 Using each_with_index is slower than while loop.
lib/alexandria/export_library.rb:15 Enumerable#sort is slower than Enumerable#sort_by.
lib/alexandria/export_library.rb:157 Using each_with_index is slower than while loop.
lib/alexandria/export_library.rb:230 Using each_with_index is slower than while loop.
lib/alexandria/book_providers/renaud.rb:131 Using each_with_index is slower than while loop.
123 files inspected, 10 offenses detected
(I'm one of the former developers of Alexandria)
mvz commented
Hi @MarcoCostantini, nice to see you found my attempt to keep Alexandria alive.
I think replacing each_with_index
with while
is going to lead to hard-to-read code and that's not worth it right now. I'll take a look at the other suggestions and see if they make sense for Alexandria.
MarcoCostantini commented
Yes, take only the suggestions that don't decrease the code readability