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

strings: build a string factory for safely and malloc limited converting bytes to string #32594

Closed
wants to merge 1 commit into from

Conversation

@junchih
Copy link

junchih commented Jun 13, 2019

Simple solution for Issue #32593

… limited allocations
@googlebot googlebot added the cla: yes label Jun 13, 2019
@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Jun 13, 2019

This PR (HEAD: 9e96984) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/182057 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Jun 13, 2019

Message from Gobot Gobot:

Patch Set 1:

Congratulations on opening your first change. Thank you for your contribution!

Next steps:
Within the next week or so, a maintainer will review your change and provide
feedback. See https://golang.org/doc/contribute.html#review for more info and
tips to get your patch through code review.

Most changes in the Go project go through a few rounds of revision. This can be
surprising to people new to the project. The careful, iterative review process
is our way of helping mentor contributors and ensuring that their contributions
have a lasting impact.

During May-July and Nov-Jan the Go project is in a code freeze, during which
little code gets reviewed or merged. If a reviewer responds with a comment like
R=go1.11, it means that this CL will be reviewed as part of the next development
cycle. See https://golang.org/s/release for more details.


Please don’t reply on this GitHub thread. Visit golang.org/cl/182057.
After addressing review feedback, remember to publish your drafts!

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Jun 13, 2019

Message from Keith Randall:

Patch Set 1:

Patch Set 1:

Congratulations on opening your first change. Thank you for your contribution!

Next steps:
Within the next week or so, a maintainer will review your change and provide
feedback. See https://golang.org/doc/contribute.html#review for more info and
tips to get your patch through code review.

Most changes in the Go project go through a few rounds of revision. This can be
surprising to people new to the project. The careful, iterative review process
is our way of helping mentor contributors and ensuring that their contributions
have a lasting impact.

During May-July and Nov-Jan the Go project is in a code freeze, during which
little code gets reviewed or merged. If a reviewer responds with a comment like
R=go1.11, it means that this CL will be reviewed as part of the next development
cycle. See https://golang.org/s/release for more details.

So this is batching allocations in 4K chunks?
The difficulty here is that that 4K chunk can't be garbage collected unless all parts of it are dead. A single live string allocated from the 4K chunk keeps the whole 4K chunk alive.
That can lead to a highly fragmented heap.


Please don’t reply on this GitHub thread. Visit golang.org/cl/182057.
After addressing review feedback, remember to publish your drafts!

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Jun 13, 2019

Message from Jan Mercl:

Patch Set 1: Code-Review-1

The StringFactory identifier and friends would be a good fit in Java perhaps. In Go not so much.

The CL talks about generating immutable strings.. Go has no mutable strings.

And the most important: The proposal that this CL implements is about an hour old and has not been discussed nor accepted.

Please do not start changing the language or the stdlib by sending a CL. The correct order is the other way around.


Please don’t reply on this GitHub thread. Visit golang.org/cl/182057.
After addressing review feedback, remember to publish your drafts!

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Jun 13, 2019

Message from Matt Layher:

Patch Set 1: Code-Review-2

Patch Set 1: Code-Review-1

The StringFactory identifier and friends would be a good fit in Java perhaps. In Go not so much.

The CL talks about generating immutable strings.. Go has no mutable strings.

And the most important: The proposal that this CL implements is about an hour old and has not been discussed nor accepted.

Please do not start changing the language or the stdlib by sending a CL. The correct order is the other way around.

Agreed, and giving temporary -2 because discussion should take place on the proposal before code is written.


Please don’t reply on this GitHub thread. Visit golang.org/cl/182057.
After addressing review feedback, remember to publish your drafts!

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Jun 13, 2019

Message from Keith Randall:

Patch Set 1:

I think it is fine to send a CL along with a proposal. It's perhaps premature, but it's certainly better than most proposals which err in the other direction in being rather light on details.

Note that the runtime already does this optimization, but with a batch size of 16 instead of 4K. Look for maxTinySize in src/runtime/mallocgc.go.

Jack, any reason why you couldn't just make this a third-party library?


Please don’t reply on this GitHub thread. Visit golang.org/cl/182057.
After addressing review feedback, remember to publish your drafts!

@gopherbot gopherbot force-pushed the golang:master branch 2 times, most recently from a1b0af9 to 93a79bb Sep 26, 2019
@gopherbot gopherbot force-pushed the golang:master branch 7 times, most recently from 4a7ed1f to 0f992b9 Nov 5, 2019
@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Nov 11, 2019

This PR is being closed because golang.org/cl/182057 has been abandoned.

Proposal was declined.

@gopherbot gopherbot closed this Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.