Thanks to visit codestin.com
Credit goes to github.com

Skip to content

reduce the number of internal functions#1270

Merged
davidchambers merged 1 commit intoramda:masterfrom
davidchambers:internal
Jul 12, 2015
Merged

reduce the number of internal functions#1270
davidchambers merged 1 commit intoramda:masterfrom
davidchambers:internal

Conversation

@davidchambers
Copy link
Member

There are currently a small number of functions defined in src/internal but never used. This pull request removes the unused files.

There are currently several cases where src/internal/_foo.js exists only for src/foo.js to be defined as curry(_foo). This pull request coalesces each such pair of files.

This pull request takes additional reasonable measures to reduce the number of files in src/internal.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change controversial? I don't think we should document the fact that R.add happens to operate on strings: R.concat performs that function.

src/addIndex.js Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be a perf regression

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this?

var args = _slice(arguments);
args[0] = indexedFn;
return fn.apply(this, args);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meh, I'm still not a big fan of the addIndex functions (too hacky and can't be extended for addKey). I'd still rather see the Index/Key functions be the default and the none key/index functions just apply unary on the predicate. But I'll try not to derail on this tangent, my thoughts are already in other threads

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this change is fine as is, I didn't realize it's only applied once

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this get the @megawac seal of approval? :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stamped!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we tested that approach and the concat one was faster. But it's only vague memories now, I'm afraid.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be very surprised if that was the case

@megawac
Copy link
Contributor

megawac commented Jul 12, 2015

I'm concerned about the performance hits for functions like reject, addIndex and others which will now be double or triple unwrapping curried functions on each step

@davidchambers davidchambers force-pushed the internal branch 2 times, most recently from 8f49265 to c4255ec Compare July 12, 2015 18:29
@CrossEye
Copy link
Member

💯

I'm very much in favor of this. If there are perf regressions, I'm bothered only if they're substantial (not that I have a precise figure in mind.) I love the code clean-up this entails.

@buzzdecafe
Copy link
Member

it might be nice to capture some data on the cost so that someone can circle back later if necessary

@davidchambers
Copy link
Member Author

@megawac, I've reinstated _complement. Removing that may be a step too far.

davidchambers added a commit that referenced this pull request Jul 12, 2015
reduce the number of internal functions
@davidchambers davidchambers merged commit 0fdfe70 into ramda:master Jul 12, 2015
@davidchambers davidchambers deleted the internal branch July 12, 2015 18:37
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.

4 participants