Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Build self_hash up from INLINE_STYLES #72

Merged
merged 1 commit into from

2 participants

@joekain
Collaborator

Iterate over each value in INLINE_STYLES instead of iterating over
each value in instances_values and rejecting unwanted items. This
version proceses fewer values and runs a little faster.

Issue #61 - Axlsx performance

@joekain joekain Build self_hash up from INLINE_STYLES
Iterate over each value in INLINE_STYLES instead of iterating over
each value in instances_values and rejecting unwanted items.  This
version proceses fewer values and runs a little faster.

Issue #61 - Axlsx performance
8190b14
@joekain
Collaborator

I took a look at performance for the use_shared_strings as discussed in Issue #61. This improves performance by about 12% for me in the axlsx_shared portion of the benchmark in issue #61.

@joekain joekain referenced this pull request
Closed

Axlsx performance #61

@randym randym merged commit b11537d into from
@randym
Owner

Thanks mate!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 31, 2012
  1. @joekain

    Build self_hash up from INLINE_STYLES

    joekain authored
    Iterate over each value in INLINE_STYLES instead of iterating over
    each value in instances_values and rejecting unwanted items.  This
    version proceses fewer values and runs a little faster.
    
    Issue #61 - Axlsx performance
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +2 −1  lib/axlsx/workbook/worksheet/cell.rb
View
3  lib/axlsx/workbook/worksheet/cell.rb
@@ -225,7 +225,8 @@ def initialize(row, value="", options={})
# equality comparison to test value, type and inline style attributes
# this is how we work out if the cell needs to be added or already exists in the shared strings table
def shareable_hash
- self_hash = self.instance_values.reject { |key, val| !INLINE_STYLES.include?(key) }
+ self_hash = {}
+ INLINE_STYLES.each { |style| self_hash[style] = self.instance_variable_get("@" + style) }
self_hash['color'] = self_hash['color'].instance_values if self_hash['color']
self_hash
end
Something went wrong with that request. Please try again.