FAQ
It seems like something in the toolchain doesn't really like

TEXT ·(*MyType)·Method

(or any permutation like ·*MyType·MyMethod)

It works fine for non-pointer receivers

TEXT ·MyType·Method

Is there any way around this? At the speed levels I'm speed gain is mostly
academic, this workaround:

func (m *MyType) Method() float32 {
     return method(m)
}

func method(m *MyType) float32

Is literally the difference between beating the compiler and not doing so.
(Again, it's academic here, we're talking ~4.5ns/op down to ~3.0ns/op
without the reroute). Mostly due to inlining, it looks like when I run
gcflags="-n", but still.

I'm just screwing around at this point, it's not a big deal, but I was just
curious if there was a way around it right now.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Brad Fitzpatrick at Sep 13, 2014 at 1:54 pm
    mtj (copied) apparently has a local patch to his assembler to permit that
    syntax. But it's intentionally not in the main tree I was once told.

    On Sat, Sep 13, 2014 at 9:09 AM, Jsor wrote:

    It seems like something in the toolchain doesn't really like

    TEXT ·(*MyType)·Method

    (or any permutation like ·*MyType·MyMethod)

    It works fine for non-pointer receivers

    TEXT ·MyType·Method

    Is there any way around this? At the speed levels I'm speed gain is mostly
    academic, this workaround:

    func (m *MyType) Method() float32 {
    return method(m)
    }

    func method(m *MyType) float32

    Is literally the difference between beating the compiler and not doing so.
    (Again, it's academic here, we're talking ~4.5ns/op down to ~3.0ns/op
    without the reroute). Mostly due to inlining, it looks like when I run
    gcflags="-n", but still.

    I'm just screwing around at this point, it's not a big deal, but I was
    just curious if there was a way around it right now.

    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Anthony Martin at Sep 13, 2014 at 8:59 pm

    Brad Fitzpatrick once said:
    mtj (copied) apparently has a local patch to his assembler to permit that
    syntax. But it's intentionally not in the main tree I was once told.
    This is the old patch: https://codereview.appspot.com/7492043/

       Anthony

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Brad Fitzpatrick at Sep 13, 2014 at 9:05 pm
    [+r, who's writing a new assembler]

    On Sat, Sep 13, 2014 at 4:59 PM, Anthony Martin wrote:

    Brad Fitzpatrick <bradfitz@golang.org> once said:
    mtj (copied) apparently has a local patch to his assembler to permit that
    syntax. But it's intentionally not in the main tree I was once told.
    This is the old patch: https://codereview.appspot.com/7492043/

    Anthony
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Michael Jones at Sep 15, 2014 at 1:10 am
    Yes and I use it with success.
    On Sep 13, 2014 2:05 PM, "Brad Fitzpatrick" wrote:

    [+r, who's writing a new assembler]

    On Sat, Sep 13, 2014 at 4:59 PM, Anthony Martin wrote:

    Brad Fitzpatrick <bradfitz@golang.org> once said:
    mtj (copied) apparently has a local patch to his assembler to permit that
    syntax. But it's intentionally not in the main tree I was once told.
    This is the old patch: https://codereview.appspot.com/7492043/

    Anthony
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Bryan Turley at Dec 14, 2014 at 8:27 pm

    On Sunday, September 14, 2014 8:10:28 PM UTC-5, Michael Jones wrote:
    Yes and I use it with success.
    What is the possibility of getting this in go1.5?

    On Sep 13, 2014 2:05 PM, "Brad Fitzpatrick" <brad...@golang.org
    <javascript:>> wrote:
    [+r, who's writing a new assembler]


    On Sat, Sep 13, 2014 at 4:59 PM, Anthony Martin <al...@pbrane.org
    <javascript:>> wrote:
    Brad Fitzpatrick <brad...@golang.org <javascript:>> once said:
    mtj (copied) apparently has a local patch to his assembler to permit that
    syntax. But it's intentionally not in the main tree I was once told.
    This is the old patch: https://codereview.appspot.com/7492043/

    Anthony
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedSep 13, '14 at 1:09p
activeDec 14, '14 at 8:27p
posts6
users5
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase