Skip to content
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

Fixes Issue #106: deep_merge recursively slow #107

Merged
merged 1 commit into from
Mar 30, 2014

Conversation

davemitchell
Copy link
Contributor

The call to custom_writer within deep_merge was exponentially converting the values (unnecessarily, since they were just converted within deep_merge). Added an optional param to custom_writer to suppress the conversion. Unfortunately, had to also add the param to coercion's customer_writer method as well (which is just ignored) to not break the inheritance.

All tests pass.

The call to custom_writer within deep_merge was exponentially converting the values (unnecessarily, since they were just converted within deep_merge).  Added an optional param to custom_writer to suppress the conversion.  Unfortunately, had to also add the param to coercion's customer_writer method as well (which is just ignored) to not break the inheritance.

All tests pass.
@jimeh
Copy link
Contributor

jimeh commented Oct 8, 2013

I was just made aware of this issue via @johnae's comment on #106. Thankfully I haven't had any massive performance issues myself, but I'll probably switch for your fork for good measure till this is merged in.

@davemitchell, I'd suggest maybe adding a test or two to ensure the behavior doesn't return further down the road. Specially since it's not exactly the most obvious of issues like a syntax error or something else silly.

@zuk
Copy link

zuk commented Oct 24, 2013

This patch worked like a charm. A Hashie::Mash.new on a big hash went form 1200 seconds to to less than 2 seconds.

@dblock
Copy link
Member

dblock commented Oct 25, 2013

Opened #116 with this change and a spec.

@morganchristiansson
Copy link

Came across this issue by profiling with ruby-prof - why has it not been merged yet? 😟

@dblock
Copy link
Member

dblock commented Mar 17, 2014

cc: @mbleigh

@bartoszkopinski
Copy link
Member

Hi @morganchristiansson,
Since this repo seems to be abandoned for almost a year now, I managed to create an up-to-date fork of Hashie and merge all the pending fixes: https://github.com/hashie/hashie
Feel free to use it until Intridea decides to move forward with the development here.

@dblock dblock merged commit 35efddc into hashie:master Mar 30, 2014
@dblock
Copy link
Member

dblock commented Mar 30, 2014

I now have access to the repo, am taking care of cleaning up the backlog and making a release. This has now been merged.

@dblock
Copy link
Member

dblock commented Mar 30, 2014

@bartoszkopinski What other PRs did you merge into your fork? I want to look at them all.

@bartoszkopinski
Copy link
Member

@dblock lol, my timing... nice job. :-)
Be careful with some of those PRs, I've merged most of them but also fixed the builds / specs, and done some refactors.
You can check out this graph here: https://github.com/intridea/hashie/network
Feel free to use the changes if needed, I'll be happy to contribute as well.

@dblock
Copy link
Member

dblock commented Mar 30, 2014

Well, your note prompted me to find @mbleigh :) Let me take some PRs, I'll diff your changes last.

jsonn pushed a commit to jsonn/pkgsrc that referenced this pull request Feb 6, 2015
${RUBY_PKGPREFIX}-hashie2.

## 2.1.2 (5/12/2014)

* [#169](hashie/hashie#169): Hash#to_hash will also convert nested objects that implement `to_hash` - [@gregory](https://github.com/gregory).

## 2.1.1 (4/12/2014)

* [#144](hashie/hashie#144): Fixed regression invoking `to_hash` with no parameters - [@mbleigh](https://github.com/mbleigh).

## 2.1.0 (4/6/2014)

* [#134](hashie/hashie#134): Add deep_fetch extension for nested access - [@tylerdooling](https://github.com/tylerdooling).
* Removed support for Ruby 1.8.7 - [@dblock](https://github.com/dblock).
* Ruby style now enforced with Rubocop - [@dblock](https://github.com/dblock).
* [#138](hashie/hashie#138): Added Hashie::Rash, a hash whose keys can be regular expressions or ranges - [@epitron](https://github.com/epitron).
* [#131](hashie/hashie#131): Added IgnoreUndeclared, an extension to silently ignore undeclared properties at intialization - [@righi](https://github.com/righi).
* [#136](hashie/hashie#136): Removed Hashie::Extensions::Structure - [@markiz](https://github.com/markiz).
* [#107](hashie/hashie#107): Fixed excessive value conversions, poor performance of deep merge in Hashie::Mash - [@davemitchell](https://github.com/dblock), [@dblock](https://github.com/dblock).
* [#69](hashie/hashie#69): Fixed assigning multiple properties in Hashie::Trash - [@einzige](https://github.com/einzige).
* [#100](hashie/hashie#100): IndifferentAccess#store will respect indifference - [@jrochkind](https://github.com/jrochkind).
* [#103](hashie/hashie#103): Fixed support for Hashie::Dash properties that end in bang - [@thedavemarshall](https://github.com/thedavemarshall).
* [89](hashie/hashie#89): Do not respond to every method with suffix in Hashie::Mash, fixes Rails strong_parameters - [@Maxim-Filimonov](https://github.com/Maxim-Filimonov).
* [#110](hashie/hashie#110): Correctly use Hash#default from Mash#method_missing - [@ryansouza](https://github.com/ryansouza).
* [#120](hashie/hashie#120): Pass options to recursive to_hash calls - [@pwillett](https://github.com/pwillett).
* [#113](hashie/hashie#113): Fixed Hash#merge with Hashie::Dash - [@spencer1248](https://github.com/spencer1248).
* [#99](hashie/hashie#99): Hash#deep_merge raises errors when it encounters integers - [@defsprite](https://github.com/defsprite).
* [#133](hashie/hashie#133): Fixed Hash##to_hash with symbolize_keys - [@mhuggins](https://github.com/mhuggins).
* [#130](hashie/hashie#130): IndifferentAccess now works without MergeInitializer - [@npj](https://github.com/npj).
* [#111](hashie/hashie#111): Trash#translations correctly maps original to translated names - [@artm](https://github.com/artm).
* [#129](hashie/hashie#129): Added Trash#permitted_input_keys and inverse_translations - [@artm](https://github.com/artm).
@andrewvc
Copy link

andrewvc commented May 3, 2015

I should probably update the hashie version. In other news, I'm looker for new maintainers if anyone in this thread is interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants