Wednesday, December 3, 2014

plato

Watching some videos from Reject JS I have learned about plato: JavaScript source code visualization, static analysis, and complexity tool. Since this is my area of interest (one of and currently) I have started a small project, plato-reports and it took me several trials and errors to make a github hosted browsable copy here analysing npm (and other packages) using this tool. It produces some charts and metrics (avg shell be histograms, and loading of large project shell be faster) but: pictures are nice and metrics inspiring:

Wednesday, March 26, 2014

Dojo and usage of has()

Quote from: http://livedocs.dojotoolkit.org/dojo/has Browser sniffing and feature inference are flawed techniques for detecting browser support in client side JavaScript. So lets face the truth, dojo's own code base and how many time has(something) is used
62 "ie"
14 "quirks"
14 "dojo-sync-loader"
12 "webkit"
11 "extend-dojo"
10 "opera"
 9 "touch"
 9 "host-browser"
 7 "safari"
 7 "mozilla"
 7 "dojo-combo-api"
 5 "mac"
 5 "dom-addeventlistener"
 5 "dojo-trace-api"
 5 "bug-for-in-skips-shadowed"
 4 "ios"
 4 "highcontrast"
 4 "dom"
 4 "dojo-requirejs-api"
 4 "config-deferredInstrumentation"
 4 "chrome"
 3 'activex'
 3 "khtml"
 3 "host-rhino"
 3 "host-node"
 3 "ff"
 3 "dojo-v1x-i18n-Api"
 3 "dojo-preload-i18n-Api"
 3 "dojo-loader-eval-hint-url"
 3 "dojo-loader"
 3 "dojo-inject-api"
 3 "dojo-config-api"
 3 "config-useDeferredInstrumentation"
 3 "config-dojo-loader-catches"
 3 "android"
 3 "air"
 2 name
 2 'native-xhr'
 2 'config-dojoBlankHtmlUrl'
 2 "trident"
 2 "ie-event-behavior"
 2 "dom-qsa2.1"
 2 "dojo-unit-tests"
 2 "dojo-undef-api"
 2 "dojo-publish-privates"
 2 "dojo-log-api"
 2 "dojo-debug-messages"
 2 "dojo-cdn"
 2 "dojo-amd-factory-scan"
 2 "array-extensible"
 1 term
 1 'script-readystatechange'
 1 'native-xhr2'
 1 'native-formdata'
 1 'mozilla'
 1 'host-node'
 1 'host-browser'
 1 'dom-qsa2.1'
 1 'dom-parser'
 1 'dojo-force-activex-xhr'
 1 'config-useXDomain'
 1 'config-requestProvider'
 1 "wii"
 1 "rtl-adjust-position-for-verticalScrollBar"
 1 "position-fixed-support"
 1 "native-xhr"
 1 "json-stringify"
 1 "json-parse"
 1 "jscript"
 1 "events-mousewheel"
 1 "events-keypress-typed"
 1 "event-stopimmediatepropagation"
 1 "event-orientationchange"
 1 "event-focusin"
 1 "dom-quirks"
 1 "dom-qsa3"
 1 "dom-qsa"
 1 "dom-parser"
 1 "dom-matches-selector"
 1 "dom-compliant-qsa"
 1 "dom-attributes-specified-flag"
 1 "dom-attributes-explicit"
 1 "dojo-timeout-api"
 1 "dojo-test-sniff"
 1 "dojo-sniff"
 1 "dojo-moduleUrl"
 1 "dojo-modulePaths"
 1 "dojo-has-api"
 1 "dojo-guarantee-console"
 1 "dojo-force-activex-xhr"
 1 "dojo-fast-sync-require"
 1 "dojo-enforceDefine"
 1 "dojo-dom-ready-api"
 1 "dojo-config-require"
 1 "dojo-config-addOnLoad"
 1 "dojo-built"
 1 "css-user-select"
 1 "config-tlmSiblingOfDojo"
 1 "config-stripStrict"
 1 "config-selectorEngine"
 1 "config-publishRequireResult"
 1 "config-_allow_leaks"

Tuesday, March 11, 2014

ios-driver

Using iOS version 7.1 iOS >= 6.0. Safari and hybrid apps are supported. No they are not !!!

Sunday, January 5, 2014

jsPerf tests for split join replace

Today I have found this code in connect middleware: exports.normalizeSlashes = function normalizeSlashes(path) { return path.split(sep).join('/'); }; So I have immediately jumped to jsPerf and wanted to compare this to alternative methods (for speed). Unlucky as always, I have run into several nonsense tests:
  • http://jsperf.com/split-join-vs-replace-47 - Both revisions 1,2 are wrong not comparing the same things
  • http://jsperf.com/regexp-vs-split-join2 - another treasure
and we could you with the list. Again and again, broken tests and misleading measurements. Please all of you who run into this article, and write or use jsPerf results please read using-jsperf-correctly.

BTW: there is enough room for fiddling elsewhere. On of the tips: "http://jsfiddle.net"

Of course split/join is much slower then intuitive replace. At least with browsers and JSPerf

Update 2013-01-06:

Irony: I have authored BUGGY TEST AS WELL: http://jsperf.com/normalizeslashes-split-join-vs-replace and I hope fixed version 2 is better ;-) http://jsperf.com/normalizeslashes-split-join-vs-replace/2