te')); return $arr; } /* 遍历用户所有主题 * @param $uid 用户ID * @param int $page 页数 * @param int $pagesize 每页记录条数 * @param bool $desc 排序方式 TRUE降序 FALSE升序 * @param string $key 返回的数组用那一列的值作为 key * @param array $col 查询哪些列 */ function thread_tid_find_by_uid($uid, $page = 1, $pagesize = 1000, $desc = TRUE, $key = 'tid', $col = array()) { if (empty($uid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('uid' => $uid), array('tid' => $orderby), $page, $pagesize, $key, $col); return $arr; } // 遍历栏目下tid 支持数组 $fid = array(1,2,3) function thread_tid_find_by_fid($fid, $page = 1, $pagesize = 1000, $desc = TRUE) { if (empty($fid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('fid' => $fid), array('tid' => $orderby), $page, $pagesize, 'tid', array('tid', 'verify_date')); return $arr; } function thread_tid_delete($tid) { if (empty($tid)) return FALSE; $r = thread_tid__delete(array('tid' => $tid)); return $r; } function thread_tid_count() { $n = thread_tid__count(); return $n; } // 统计用户主题数 大数量下严谨使用非主键统计 function thread_uid_count($uid) { $n = thread_tid__count(array('uid' => $uid)); return $n; } // 统计栏目主题数 大数量下严谨使用非主键统计 function thread_fid_count($fid) { $n = thread_tid__count(array('fid' => $fid)); return $n; } ?>javascript - How can I try out SIMD instructions in Chrome? - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How can I try out SIMD instructions in Chrome? - Stack Overflow

programmeradmin5浏览0评论

I would like to experiment with SIMD (single instruction multiple data). From what I can glean from Google Group postings, people have been working to add this to Google Chrome, but when I try to call SIMD.Float32x4 in Chrome 46, I get that SIMD is undefined.

My googling suggests there might be some experimental versions of Chrome that have SIMD support. What is the newest version that includes it and what mand line flags need to be set in order to use it? Do I need to use strict mode?

When will SIMD be rolled into the stable Chrome build?

Also does it make a difference running SIMD instructions if I run a 32 bit version of Chrome or a 64 bit version?

I would like to experiment with SIMD (single instruction multiple data). From what I can glean from Google Group postings, people have been working to add this to Google Chrome, but when I try to call SIMD.Float32x4 in Chrome 46, I get that SIMD is undefined.

My googling suggests there might be some experimental versions of Chrome that have SIMD support. What is the newest version that includes it and what mand line flags need to be set in order to use it? Do I need to use strict mode?

When will SIMD be rolled into the stable Chrome build?

Also does it make a difference running SIMD instructions if I run a 32 bit version of Chrome or a 64 bit version?

Share Improve this question edited Nov 29, 2016 at 21:59 Yves M. 31k24 gold badges109 silver badges149 bronze badges asked Oct 28, 2015 at 21:48 brucecengbruceceng 2,1821 gold badge19 silver badges24 bronze badges 2
  • Maybe the Google developer forum would be a better place to ask this. – Barmar Commented Oct 28, 2015 at 22:09
  • 2 Note to future visitors: Looks like chrome is dropping SIMD support in JS and only allowing it in WebAssembly :\ – user993683 Commented Jun 24, 2017 at 4:21
Add a ment  | 

2 Answers 2

Reset to default 12

Update (24/6/17): Chrome is dropping SIMD support in JS and only allowing it in WebAssembly.


Update: Now it's possible in the latest version of Chrome with a flag:

--js-flags="--harmony-simd"

In Chrome shortcut properties(i.e. on your desktop) "Target" field will look something like this

"C:\Users\Pav\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --js-flags="--harmony-simd"

Old answer:

You can try them out in Node before they will be added to Chrome (same JavaScript engine)

  1. Install latest Node from https://nodejs/en/

  2. Run your JavaScript as "node --harmony-simd index.js" (your code in index.js)

  3. Print output from your script just like in Chrome console using console.log('BANG') or just log('TEST 2')

Option 2

Not Chrome solution but you can use SIMD in Firefox. Download Firefox Nightly which has SIMD already integrated. SIMD is almost identical between browsers.

https://nightly.mozilla/

If someone could explain how to build the latest Chromium with native SIMD(not polyfill as it's now) support that would be great.

It seems that the extent of SIMD in Chromium is an experimental contribution by Intel from 2013.

You can try it out in a special build of Chromium 37 (ia32). Source: IDF14 demo links.

To try it out download the build for your platform and start with the mand-line flag --js-flags=--simd-object.

For example, on OSX:

./Chromium.app/Contents/MacOS/Chromium --js-flags=--simd-object

The SIMD object is available in the JavaScript console:

var a = SIMD.float32x4(1, 2, 3, 4);
var b = SIMD.float32x4(5, 6, 7, 8);
var c = SIMD.float32x4.add(a,b);
console.log(c.toString())
// > float32x4(6,8,10,12) 

I could find no information about intent to merge (but would love to hear something authoritative).

发布评论

评论列表(0)

  1. 暂无评论