Skip to content

Eliminate data copy when encoding string with PythonEncoding (2)#941

Merged
BCSharp merged 5 commits intoIronLanguages:masterfrom
BCSharp:encoding_perf
Sep 21, 2020
Merged

Eliminate data copy when encoding string with PythonEncoding (2)#941
BCSharp merged 5 commits intoIronLanguages:masterfrom
BCSharp:encoding_perf

Conversation

@BCSharp
Copy link
Copy Markdown
Member

@BCSharp BCSharp commented Sep 19, 2020

This is a continuation of #923, which I inadvertently closed. Commits form Aug 08 have been already reviewed by @slozier.

Copy link
Copy Markdown
Contributor

@slozier slozier left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good to me. Testing failures are unrelated (.NET Core 2.1 testing broke on github actions updated their image and SMTP failures on Azure occur frequently -- no idea why).

}

public override int GetByteCount(char[] chars, int index, int count) {
private void PrepareResidentEncoder() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Might be a good candidate for [MemberNotNull(nameof(_residentEncoder))]. C# 9 isn't out yet, but I think it might work if we bump the Nullable package to 1.3.0 and maybe LangVersion to preview? Then we could get rid of all the ! below.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It is a very nice idea. I have tried it out locally and indeed it works with Nullable at 1.3.0 and LangVersion at preview. But do we really want to set the language version to preview? As I understand it, it allows the code to use any language features from C# 9.0 without warnings, but some features from above C# 7.3 may not work on .NET Framework or .NET Core 2.x. If we accidentally use any of them, we loose compiler errors.

Anyway, there are more places that may benefit from MemberNotNullAttibute (e.g. I'm thinking of MemoryView), so I think it is better to do in a separate PR.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

On the other hand, I tried to "accidentally" use a few of those newer features and the build still fails for one reason or another. So maybe my concern is not justified.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, I'm not too concerned about it, as you say if it's supported then it'll work, otherwise it'll fail in one way or another. We could also wait for the November release (that way we don't have to roll back preview to latest). Just don't want to forget about it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'd rather wait will November. Who knows what surprises a "preview" version may have. I have set a reminder so no worry about forgetting.

@BCSharp BCSharp merged commit c137c04 into IronLanguages:master Sep 21, 2020
@BCSharp BCSharp deleted the encoding_perf branch September 21, 2020 16:34
@BCSharp
Copy link
Copy Markdown
Member Author

BCSharp commented Sep 22, 2020

.NET Core 2.1 testing broke on github actions updated their image and SMTP failures on Azure occur frequently -- no idea why

It appears that .NET Core 3.1 SDK does not install any 2.x anymore. 2.2 is EOL and 2.1 is in LTS so maybe we need an extra setup action to install 2.1.22 runtime on CI?

@slozier
Copy link
Copy Markdown
Contributor

slozier commented Sep 22, 2020

Yeah, I have a fix for the actions bit in my PR, I can merge it to master. It's the bit about SMTP that's got me stumped.

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.

2 participants