Editing String to Array (16bit) This edit will create a new revision. Your details (optional) Name Email (won’t be displayed; might be used for Gravatar) URL Test case details Title * Published (uncheck if you want to fiddle around before making the page public) Description (in case you feel further explanation is needed)(Markdown syntax is allowed) Are you a spammer? (just answer the question) Preparation code Preparation code HTML (this will be inserted in the <body> of a valid HTML5 document in standards mode) (useful when testing DOM operations or including libraries) Include JavaScript libraries as follows: <script src="//cdn.ext/library.js"></script> Define setup for all tests (variables, functions, arrays or other objects that will be used in the tests) (runs before each clocked test loop, outside of the timed code region) (e.g. define local test variables, reset global variables, clear canvas, etc.) (see FAQ) var input = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer lectus quam, adipiscing sit amet lobortis eu, lacinia ac lacus. Etiam luctus commodo enim, sit amet iaculis ante dictum in. Ut ut eros sed lacus eleifend pretium. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum vel elit neque. Etiam fringilla lobortis arcu et sollicitudin. Nulla convallis augue at sapien tempor scelerisque. Donec felis mi, tempor sit amet aliquet et, laoreet id elit. Nunc mollis, arcu sed laoreet fermentum, ligula urna fringilla enim, vel dictum massa massa vel nibh. Pellentesque vel mauris massa. Phasellus vulputate nisl sit amet velit bibendum ac commodo quam interdum. Quisque sed enim neque, vitae faucibus augue. Nulla iaculis arcu a ligula congue convallis. Suspendisse bibendum tincidunt elit quis luctus. Donec consequat viverra urna in lacinia. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nunc sit amet."; Define teardown for all tests (runs after each clocked test loop, outside of the timed code region) (see FAQ) Code snippets to compare Test 1 Title Async (check if this is an asynchronous test) Code var length = input.length; var result = new Array(length); for (var i = 0; i < length; i++) { result[i] = input.charCodeAt(i); } var u16 = new Uint16Array(result); Test 2 Title Async (check if this is an asynchronous test) Code var length = input.length; var u16 = new Uint16Array(length); for (var i = 0; i < length; i++) { u16[i] = input.charCodeAt(i); }