denormalizr icon indicating copy to clipboard operation
denormalizr copied to clipboard

Adding memoization

Open yachaka opened this issue 9 years ago • 13 comments
trafficstars

Hello,

This is the PR discussed in issue #10. API follows what has been discussed : { memoized: true } to activate memoization.

I've been rather busy so I just added few tests and the overall code could be refactored in some points somehow but it does the job.

Needs the docs to be partly rewritten though to explain how to use/the advantages of using memoization.

Note: the cache is for now global. In the future. It would be necessary to take is as argument to allow the user to maintain a cache for each set of entity he might be using.

yachaka avatar Sep 28 '16 16:09 yachaka

Awesome @yachaka, thanks a lot! Please give some some time to review the changes.

gpbl avatar Sep 28 '16 18:09 gpbl

@yachaka Thanks again for your PR. Yes, I see the need of a refactoring to avoid some code dupes... If you are have some time for a code review, we can work on this together, otherwise I can try updating the branch myself in the next days.

gpbl avatar Oct 04 '16 11:10 gpbl

@yachaka Thanks for this. Really looking forward to this change. 🎉

clessg avatar Oct 04 '16 13:10 clessg

@clessg Thanks for the feedback ! Really appreciated ! :) @gpbl I can look onto refactoring a little next week, if no one does !

yachaka avatar Oct 04 '16 14:10 yachaka

Sorry, I've broken the PR fixing up some code in master :( The valuable code is still visible and reusable from the diff.

gpbl avatar Oct 09 '16 21:10 gpbl

I will be able to look into refactoring along your comments this friday. ;)

yachaka avatar Oct 10 '16 20:10 yachaka

Hey guys. Any updates on this?

diegohaz avatar Nov 29 '16 12:11 diegohaz

@diegohaz I've been a lot busy lately (just started a new job), but I will into refactoring this week (promess 😸). For now, you can use my fork (yachaka/denormalizr) ; it works with memoization using { memoized: true } as the first argument.

yachaka avatar Nov 29 '16 12:11 yachaka

Coverage Status

Coverage decreased (-8.4%) to 91.603% when pulling 8238d5057b74e9ded61943d02cf51f3aab0f32af on yachaka:master into 08ede86a2c472cb1d6ad54e3f60455e2ecf0d7fc on gpbl:master.

coveralls avatar Dec 10 '16 15:12 coveralls

Coverage Status

Coverage decreased (-8.4%) to 91.603% when pulling ee2d493457ace530ecb48d6ffae49b0ff13e8859 on yachaka:master into 08ede86a2c472cb1d6ad54e3f60455e2ecf0d7fc on gpbl:master.

coveralls avatar Dec 10 '16 15:12 coveralls

@gpbl Updated README, added some code comment. I didn't refactor the denormalize entry point function ; I think it is more readable this way - splitted into 2 functions. In term of performance, it also eliminates a check. Please review 👍

yachaka avatar Dec 10 '16 15:12 yachaka

Coverage Status

Coverage decreased (-8.4%) to 91.603% when pulling 95b72837cc005328daf7c078c74cd743842a915a on yachaka:master into 08ede86a2c472cb1d6ad54e3f60455e2ecf0d7fc on gpbl:master.

coveralls avatar Dec 10 '16 15:12 coveralls

@gpbl Sup ?

yachaka avatar Jan 26 '17 12:01 yachaka