Swift creduce


(Doug Hill) #1

Is there a version of 'creduce' for Swift?

I did some basic googling and didn't find anything, so I thought I'd ask here.

Thanks.

Doug Hill


(Slava Pestov) #2

Huon noticed that creduce actually works pretty well with Swift as-is. I’ve been using it without any issues.

Slava

···

On Apr 19, 2017, at 3:53 PM, Doug Hill via swift-users <swift-users@swift.org> wrote:

Is there a version of 'creduce' for Swift?

I did some basic googling and didn't find anything, so I thought I'd ask here.

Thanks.

Doug Hill
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Doug Hill) #3

Ok, that's unexpected. Does creduce know about Swift now?

Doug Hill

···

On Apr 19, 2017, at 5:13 PM, Slava Pestov <spestov@apple.com> wrote:

Huon noticed that creduce actually works pretty well with Swift as-is. I’ve been using it without any issues.

Slava

On Apr 19, 2017, at 3:53 PM, Doug Hill via swift-users <swift-users@swift.org> wrote:

Is there a version of 'creduce' for Swift?

I did some basic googling and didn't find anything, so I thought I'd ask here.

Thanks.

Doug Hill


(Huon Wilson) #4

No; Swift just looks C-like enough that many of the various heuristics creduce has still work reasonably efficiently. Unless one's “good or not” script is doing something weird, the areas where creduce doesn’t understand Swift are ignored, because the compiler output is not going to match what the script is checking for.

The main downside of it not understanding Swift is that it is likely to be slower than on C, since it’ll be wasting its time on some mutations that will very very rarely be interesting.

Huon

···

On Apr 19, 2017, at 17:16, Doug Hill <swiftusers@breaqz.com> wrote:

Ok, that's unexpected. Does creduce know about Swift now?

Doug Hill

On Apr 19, 2017, at 5:13 PM, Slava Pestov <spestov@apple.com> wrote:

Huon noticed that creduce actually works pretty well with Swift as-is. I’ve been using it without any issues.

Slava

On Apr 19, 2017, at 3:53 PM, Doug Hill via swift-users <swift-users@swift.org> wrote:

Is there a version of 'creduce' for Swift?

I did some basic googling and didn't find anything, so I thought I'd ask here.

Thanks.

Doug Hill


(Doug Hill) #5

Wow, very cool. I'm not going to lie, creduce really does have some magic going on. :slight_smile:

Thanks everyone, I'll go back to creduce and see how it handles Swift.

Doug Hill

···

On Apr 19, 2017, at 5:21 PM, Huon Wilson <huon@apple.com> wrote:

No; Swift just looks C-like enough that many of the various heuristics creduce has still work reasonably efficiently. Unless one's “good or not” script is doing something weird, the areas where creduce doesn’t understand Swift are ignored, because the compiler output is not going to match what the script is checking for.

The main downside of it not understanding Swift is that it is likely to be slower than on C, since it’ll be wasting its time on some mutations that will very very rarely be interesting.

Huon

On Apr 19, 2017, at 17:16, Doug Hill <swiftusers@breaqz.com> wrote:

Ok, that's unexpected. Does creduce know about Swift now?

Doug Hill

On Apr 19, 2017, at 5:13 PM, Slava Pestov <spestov@apple.com> wrote:

Huon noticed that creduce actually works pretty well with Swift as-is. I’ve been using it without any issues.

Slava

On Apr 19, 2017, at 3:53 PM, Doug Hill via swift-users <swift-users@swift.org> wrote:

Is there a version of 'creduce' for Swift?

I did some basic googling and didn't find anything, so I thought I'd ask here.

Thanks.

Doug Hill


(Huon Wilson) #6

Sorry, I was inaccurate: there’s also some syntactic constructs that don’t get minimized as much as they could because they’re too “complicated". The most common one I’ve noticed is instance variable without defaults: creduce doesn’t seem to be able to coordinate removing both declaration and the later initialization at the same time, and it’s invalid to remove either one individually.

However, I’ve found doing one run of creduce, followed by some hand editing to tease out any those sort of dependencies remaining (including just replacing function bodies with fatalError()), lets a second run finish the job. Alternatively, after the first run, the code is often small enough that one can just do the rest by hand without a second run.

Huon

···

On Apr 19, 2017, at 17:21, Huon Wilson via swift-users <swift-users@swift.org> wrote:

No; Swift just looks C-like enough that many of the various heuristics creduce has still work reasonably efficiently. Unless one's “good or not” script is doing something weird, the areas where creduce doesn’t understand Swift are ignored, because the compiler output is not going to match what the script is checking for.

The main downside of it not understanding Swift is that it is likely to be slower than on C, since it’ll be wasting its time on some mutations that will very very rarely be interesting.

Huon

On Apr 19, 2017, at 17:16, Doug Hill <swiftusers@breaqz.com> wrote:

Ok, that's unexpected. Does creduce know about Swift now?

Doug Hill

On Apr 19, 2017, at 5:13 PM, Slava Pestov <spestov@apple.com> wrote:

Huon noticed that creduce actually works pretty well with Swift as-is. I’ve been using it without any issues.

Slava

On Apr 19, 2017, at 3:53 PM, Doug Hill via swift-users <swift-users@swift.org> wrote:

Is there a version of 'creduce' for Swift?

I did some basic googling and didn't find anything, so I thought I'd ask here.

Thanks.

Doug Hill

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users