Optimize/ruby 2.7/rows with headers#2
Open
baptistejub wants to merge 6 commits intocreek2.1-optimize-parse-speedfrom
Open
Optimize/ruby 2.7/rows with headers#2baptistejub wants to merge 6 commits intocreek2.1-optimize-parse-speedfrom
baptistejub wants to merge 6 commits intocreek2.1-optimize-parse-speedfrom
Conversation
* Always return a Time object for DateTime cells * Fix specs for DateTime parsing
…ad of array of values) Fix datetime conversion
jpbougie
reviewed
Feb 3, 2021
lib/creek/sheet.rb
Outdated
| @header_row_number = row_number.to_s | ||
|
|
||
| rows_with_meta_data.each do |row| | ||
| return (@headers = row['cells'].any? && row['cells']) if @header_row_number == row['r'] |
Member
There was a problem hiding this comment.
Hmm cette méthode pourrait donc retourner false? Ça serait à ajuster dans la documentation
Co-authored-by: Jean-Philippe Bougie <jean-philippe@demarque.com>
jpbougie
approved these changes
Feb 5, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pour garder une trace un peu plus claire des changements amenés par ce fork.
À l'origine une grosse passe d'optimisation du parsing par @jpbougie (https://github.com/demarque/creek/tree/optimize-parse-speed) qui a remplacé le parsing DOM par un parsing "Sax" (classe Reader de Nokogiri qui est une interface de Sax).
Par la suite, présentés ici, quelques ajustements :
{ header => value }(un peu comme CSV qui a aussi une option headers), pour un accès un peu plus facile aux valeurs pour l'appelant.4.1. Une possibilité similaire a aussi été ajoutée au repo officiel, mais ici c'est une implémentation maison qui marche avec le travail d'optimisation déjà fait.
4.2. Au départ une option pensée pour être utilisée dans Tally.
4.3. Performance : jusqu'à 25 % plus lent que la version "array simple" (testé sur un énorme Excel de 188 Mo : de 700 à 860 secondes); consommation de RAM similaire.
4.4. Les headers sont parsés en faisant une première lecture partielle du fichier, jusqu'à la ligne des headers. L'accès aux rows reparse le fichier de 0. Je pense que c'est acceptable côté performance.