Skip to content

Conversation

@niaow
Copy link
Member

@niaow niaow commented Apr 7, 2020

Previously, we implemented individual bytealg functions via linknaming, and had to update them every once in a while when we hit linker errors. Instead, this change reimplements the bytealg package in pure Go. If something is missing, it will cause a compiler error rather than a linker error. This is easier to test and maintain.

NOTE: The next Go release (1.15) is set to include Rabin-Karp string searches, which will require adding some code to this.

Previously, we implemented individual bytealg functions via linknaming, and had to update them every once in a while when we hit linker errors.
Instead, this change reimplements the bytealg package in pure Go.
If something is missing, it will cause a compiler error rather than a linker error.
This is easier to test and maintain.
@niaow niaow added this to the v0.14 milestone Apr 8, 2020
@aykevl
Copy link
Member

aykevl commented May 13, 2020

It looks like you copied code from the main Go implementation. Is that true? If so, this should be indicated at the top of the file.

@niaow
Copy link
Member Author

niaow commented May 13, 2020

I do not believe that I did. Should we try copying the main Go implementation and modifying it?

@aykevl
Copy link
Member

aykevl commented May 16, 2020

No, I was just asking to be sure (for copyright reasons).

@aykevl aykevl merged commit 473644d into tinygo-org:dev May 16, 2020
@aykevl
Copy link
Member

aykevl commented May 16, 2020

Thank you, this is a much-needed cleanup of the ad hoc string/bytes algorithms.
I hope a pure Go implementation is fast enough. If it is not, we should first consider optimizing the compiler instead of writing assembly implementations (as that will benefit all code).

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