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

fix binaryFun #2723

Merged
merged 1 commit into from Nov 17, 2014
Merged

fix binaryFun #2723

merged 1 commit into from Nov 17, 2014

Conversation

9il
Copy link
Member

@9il 9il commented Nov 14, 2014

Old log:#2720
Remove import of half of phobos for 100% cases in phobos.

sort, cmp, find, startsWith, sum and other algorithms would be compiled faster.

See also: Issue 13253 - use more scoped imports in phobos

@9il 9il mentioned this pull request Nov 14, 2014
@quickfur
Copy link
Member

Very nice! LGTM. I'll let other reviewers take a look as well, since this is a non-trivial change.

@@ -19,9 +19,11 @@ Distributed under the Boost Software License, Version 1.0.
http://www.boost.org/LICENSE_1_0.txt)
*/
module std.functional;
//debug = std_functional;

Choose a reason for hiding this comment

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

I have rather bad experience with debug(XXX) versioned blocks in published code - it tends to be both too opinionated and inflexible to be widely useful and bitrots because ignored by tester.

Copy link
Member Author

Choose a reason for hiding this comment

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

This only for manual tests and debuging. See pragmas.

Choose a reason for hiding this comment

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

I understand but it pollutes code of the module with pragmas needed primarily by you. In my opinion it is better to keep such changes in forked branch and merge on top of upstream when debugging the module. This is just my personal opinion of course but we had a lot of trouble with debug printfs / pragmas in internal Sociomantic projects exactly because of that :(

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought this is Phobos conversion std_modulename. See std.algorithm source code.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I think we should keep debug statements out of Phobos code, unless it is universally useful to all Phobos developers. You can of course use them while developing your PR, but I'd propose removing them before merging into master.

Copy link
Member Author

Choose a reason for hiding this comment

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

Should I remove pragmas with debug?

Copy link
Member Author

Choose a reason for hiding this comment

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

OK

@9il
Copy link
Member Author

9il commented Nov 14, 2014

Rebased.

@DmitryOlshansky
Copy link
Member

Awesome.
I think that while CTFE expression matcher is somewhat unconventional (all the arithmetic - heh ) it strikes the right balance between simplicity and generality, so a big +1 from me.

@mihails-strasuns
Copy link

LGTM

@dnadlinger
Copy link
Member

Does it still make sense to canonicalize the functions to once whitespace variant if there's a match?

if (op.length >= name.length && op[0..name.length] == name)
{
op = op[name.length..$];
return true;
Copy link
Member

Choose a reason for hiding this comment

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

IMO just using 0/1 would be clearer here.

@9il
Copy link
Member Author

9il commented Nov 15, 2014

@klickverbot Please give me an example. I don't understand you about canonicalisation.

@quickfur
Copy link
Member

I think he meant you should return 0 or 1 instead of false or true, because the return type of the function is uint not bool.

1. Make binaryFun correct for integer comparison.
2. Remove import of half of phobos for 100% cases in phobos.

`sort`, `cmp`, `find`, `startsWith`,  `sum` and other algorithms would
be compiled faster.

fix safeOp

fix safeOPs

Fix new unittest

fix binaryReverseArgs

fix not

fix new code

fix spaces after if

optimization

1. CTFE
2. Runtime (without inlining)

change condition

fix new code

fix safeOp

optimize CTFE

CTFE optimization

immutable -> enum

remove aliases

remove macros

CTFE matching

add debug info && fix not

add spaces

minor fix

added debug example

add debug unittests & fix

fix also and add unittests

fix

typo

if (!__ctfe) assert(false); added

use 01
@9il
Copy link
Member Author

9il commented Nov 15, 2014

false true fixed

@dnadlinger
Copy link
Member

I meant only actually emitting one function for "a < b", "a<b" and any other whitespace variant. In any case, this would only be a further optimization.

@9il
Copy link
Member Author

9il commented Nov 15, 2014

I think this ( emitting one function ) should be other PR. Also I don't see the fast implementation with UTF8 support and without encoding/decoding.

@quickfur
Copy link
Member

I think we should merge this first, and collapsing functions for "a < b" and "a<b" can be done as an enhancement request in a subsequent PR.

@quickfur
Copy link
Member

Auto-merge toggled on

quickfur pushed a commit that referenced this pull request Nov 17, 2014
@quickfur quickfur merged commit ea52f8e into dlang:master Nov 17, 2014
@9il 9il deleted the binaryfun branch November 17, 2014 09:48
@CyberShadow
Copy link
Member

This pull request introduced a regression:
https://issues.dlang.org/show_bug.cgi?id=14564

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