Skip to content
This repository was archived by the owner on Jul 5, 2020. It is now read-only.
This repository was archived by the owner on Jul 5, 2020. It is now read-only.

output size is 16 times bigger than input??? #26

Open
@vincenzoml

Description

@vincenzoml

Hi, perhaps it's me not understanding how to use turbo.js, but I have the following test program, which produces an array of size 256, whereas I would expect it to produce an array of size 16 by reading (perhaps in a wrong way) the docs. Indeed that's because in "alloc" there is a line reading "data: new Float32Array(ns * 16)", and the values of sz and ns are the same when sz is a power of two. Could you clarify or maybe this is actually a bug?


    let k = 16
    var input = turbojs.alloc(k)

    var t0 = window.performance.now()
    for (let i = 0; i < k; i++) input.data[i] = i
    var t1 = window.performance.now()
    console.log(t1 - t0)

    t0 = window.performance.now()
    turbojs.run(input, `
      void main(void) {
        commit(read());
      }
      `)
    t1 = window.performance.now()
    console.log(t1 - t0)
  }

  console.log(input.data)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions