Skip to content

pointer-params test case behaves differently on Windows #1

@Wuvist

Description

@Wuvist

In pointer-params.md, it says

func (v *vec2) add(u *vec2) *vec2 {
	v.x += u.x
	v.y += u.y
	v.z += u.z
	v.w += u.w
	return v
}

is slower than the vec1, due to "inlining". But NO, the main reason that it's slow it because it has more lines of intructions, just change the function to:

func (v *vec2) add(u *vec2) *vec2 {
	v.x, v.y, v.z, v.w = v.x+u.x, v.y+u.y, v.y+u.y, v.w+u.w
	return v
}

And vec2 out perform vec1 in both inline & noinline case.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions