W3C home > Mailing lists > Public > public-rdfjs@w3.org > July 2014

URL classes in node and Scala-JS

From: <henry.story@bblfish.net>
Date: Wed, 9 Jul 2014 16:08:03 +0200
Message-Id: <D75898CB-287D-4BD8-B442-D54BBF76F55C@bblfish.net>
To: public-rdfjs@w3.org
Hi all,

	I have been working on comparing the node URL library and the akka Scala Uri library
after porting it to Scala-JS.

   https://github.com/bblfish/node.scalajs
   https://github.com/bblfish/akka.http.model.Uri

The current results are that paring a 9.1MB file of URLs

   	 37 seconds to parse using Akka's Uri class ported to ScalaJS in Chrome 36.0.1985.97 beta
	 4.226 seconds using the node.js Uri library in Chrome 36...
	 4.4 seconds when running node's Url class in node.js  itself 
	 1.453 seconds to parse in the pure scala command line in the JVM

This suggests that parsing and canonicalisation of URLs should be done on the server, which should as much as possible send zipped and canonicalised n-triples files to the client. The client should then do as little as possible URI analysis - perhaps not more than removing #fragments. The client should stick as much as possible to simple string comparison.

If others want to verify the tests please do. I may very well have made some mistakes, as I am new to JS. 

Note that the Uri library in ScalaJS is only 278 bytes or so long uncompressed!

-rw-r--r--  1 hjs  staff   278B  7 Jul 11:03 http-model-uri-opt.js

The scalajs team have been optimising bytecode size until now and will be starting to optimise speed next. :-)

Henry

Social Web Architect
http://bblfish.net/
Received on Wednesday, 9 July 2014 14:08:35 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 19:48:21 UTC