davidmarkclements / rfdc

Really Fast Deep Clone
MIT License
643 stars 25 forks source link

Add `fast-clone` to benchmark #6

Open niftylettuce opened 5 years ago

niftylettuce commented 5 years ago
λ ~/Projects/rfdc/ master* npm run bench

> rfdc@1.1.4 bench /Users/jack/Projects/rfdc
> node benchmark

benchDeepCopy*100: 748.877ms
benchLodashCloneDeep*100: 1893.592ms
benchFastClone*100: 3946.849ms
benchFastCopy*100: 1056.753ms
benchRfdc*100: 427.176ms
benchRfdcProto*100: 435.255ms
benchRfdcCircles*100: 490.022ms
benchRfdcCirclesProto*100: 487.759ms
benchDeepCopy*100: 750.964ms
benchLodashCloneDeep*100: 1955.513ms
benchFastClone*100: 4271.341ms
benchFastCopy*100: 1088.407ms
benchRfdc*100: 528.183ms
benchRfdcProto*100: 529.741ms
benchRfdcCircles*100: 497.151ms
benchRfdcCirclesProto*100: 486.490ms

Ref:

codeandcats commented 5 years ago

Hi @davidmarkclements, I wouldn't bother adding fast-clone to the benchmark. As I mentioned in the referenced issue, I wrote that library a few years ago and while it was the fastest I could find at the time, other libraries have since improved and overtaken it (such as your own). I don't have time to optimise/enhance it further so I'll most likely depreciate it.

davidmarkclements commented 5 years ago

hey @codeandcats - theres two alternatives if you're interested

Option 1

replace https://github.com/codeandcats/fast-clone/blob/master/src/index.ts#L38 with rfdc(value), you could also remove https://github.com/codeandcats/fast-clone/blob/master/src/index.ts#L28-L32. The only difference is it would reference any functions from the original object, so that might take some documenting

Option 2

deprecate as planned, but would you consider passing on the namespace? - it's a crowded area hence rfdc

codeandcats commented 5 years ago

Hi David,

Yeah it's pretty hard to find a decent name for packages on npm these days (hence why I recently created this little site to help find/suggest a name 😉).

Option 2: If you want to rename rfdc to fast-clone then I'm happy to add you as a collaborator on npm so you can deploy your repo there. Though, what would you do with the rfdc name on npm? Leave it as is and stop publishing new versions to it? Deprecate it and point to fast-clone? Push new versions to both?

niftylettuce commented 5 years ago

I left a few comments over on https://github.com/codeandcats/fast-clone/issues/27 a bit ago.

Also I wanted to share this blog post https://medium.com/@roman.zenka/the-twin-volcanoes-of-javascript-533fc7a9c3e6 which discusses the extensive amount of packages that do cloning. It's a good read.

davidmarkclements commented 5 years ago

@niftylettuce very cool!

@codeandcats While rfdc has 20k shy of 1m dl's p/w it only has 13 dependents, so I'd deploy fast-clone v2.0.0 (which would be rfdc) and then PR the 13 dependents letting them know. I wouldn't deprecate until log4js has accepted the PR, because log4js is responsible for the majority of downloads and I'd rather not freak out a fraction of their millions of users, which then may cause unnecessary overhead for the log4js authors as they interact with users opening issues etc. But yeah if this works for you, it works for me

codeandcats commented 5 years ago

@davidmarkclements cool, sounds like a responsible plan of action. 👌

I have added you as a maintainer for fast-clone on npm. Go for it. 😃