FAQ
I have some inner loops which are calling math.IsNaN() a very large number
of times. I looked at the code for IsNaN and it is just returning f != f.
Is this function call in-lined by the compiler?

Thanks

wu

--
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

  • Matthew Kane at Jun 19, 2015 at 3:07 pm
    If you are using the gc compiler, you can pass the compiler the “-m”
    flag. With the go build command, add `-gcflags “-m”` to your
    invocation.
    On Fri, Jun 19, 2015 at 11:01 AM, wrote:
    I have some inner loops which are calling math.IsNaN() a very large number
    of times. I looked at the code for IsNaN and it is just returning f != f. Is
    this function call in-lined by the compiler?

    Thanks

    wu

    --
    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.


    --
    matt kane's brain
    im: mkb.dirtyorg@gmail.com (gtalk) / mkbatwerk (AIM)
    twitter: the_real_mkb / nynexrepublic
    http://hydrogenproject.com

    --
    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.
  • Webuser1200 at Jun 20, 2015 at 12:28 pm
    Thanks for the compiler flags. So it seems that math.IsNaN() is not
    inlined. I copied the IsNaN function to my package and it was still not
    in-lined. I just replaced the function call with f!=f.

    Does anyone know what the rules are for a function to be in-lined or not?
    It would seem IsNaN is a very simple function and would be ideal to be
    in-lined.
    On Friday, June 19, 2015 at 11:07:31 AM UTC-4, mkb wrote:

    If you are using the gc compiler, you can pass the compiler the “-m”
    flag. With the go build command, add `-gcflags “-m”` to your
    invocation.

    On Fri, Jun 19, 2015 at 11:01 AM, <webus...@gmail.com <javascript:>>
    wrote:
    I have some inner loops which are calling math.IsNaN() a very large number
    of times. I looked at the code for IsNaN and it is just returning f != f. Is
    this function call in-lined by the compiler?

    Thanks

    wu

    --
    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...@googlegroups.com <javascript:>.
    For more options, visit https://groups.google.com/d/optout.


    --
    matt kane's brain
    im: mkb.di...@gmail.com <javascript:> (gtalk) / mkbatwerk (AIM)
    twitter: the_real_mkb / nynexrepublic
    http://hydrogenproject.com
    --
    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.
  • Carlos Castillo at Jun 22, 2015 at 1:28 am
    AFAIK, it is inlined. Both in go 1.4 and 1.5.

    Compiling http://play.golang.org/p/HywIsDMfe0 with "-gcflags -m" set shows:

    Go 1.5:
    $ go build -gcflags -m
    # nan
    ./nan.go:10: inlining call to math.IsNaN
    ./nan.go:10: math.IsNaN(x) escapes to heap
    ./nan.go:10: main ... argument does not escape

    Go 1.4:
    $ go build -gcflags -m
    # nan
    ./nan.go:10: inlining call to math.IsNaN
    ./nan.go:10: main ... argument does not escape

    What version of go are you running? How are you determining that it is not
    being inlined?
    On Saturday, June 20, 2015 at 5:28:34 AM UTC-7, webus...@gmail.com wrote:

    Thanks for the compiler flags. So it seems that math.IsNaN() is not
    inlined. I copied the IsNaN function to my package and it was still not
    in-lined. I just replaced the function call with f!=f.

    Does anyone know what the rules are for a function to be in-lined or not?
    It would seem IsNaN is a very simple function and would be ideal to be
    in-lined.
    On Friday, June 19, 2015 at 11:07:31 AM UTC-4, mkb wrote:

    If you are using the gc compiler, you can pass the compiler the “-m”
    flag. With the go build command, add `-gcflags “-m”` to your
    invocation.
    On Fri, Jun 19, 2015 at 11:01 AM, wrote:
    I have some inner loops which are calling math.IsNaN() a very large number
    of times. I looked at the code for IsNaN and it is just returning f != f. Is
    this function call in-lined by the compiler?

    Thanks

    wu

    --
    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...@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.


    --
    matt kane's brain
    im: mkb.di...@gmail.com (gtalk) / mkbatwerk (AIM)
    twitter: the_real_mkb / nynexrepublic
    http://hydrogenproject.com
    --
    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
postedJun 19, '15 at 3:01p
activeJun 22, '15 at 1:28a
posts4
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase