Skip to content
Browse files

Added js native , non streams

  • Loading branch information...
1 parent 85bf59f commit b3e3a179c743b734f252245d4ee55b2d0e9fb39d @AvnerCohen committed Oct 8, 2012
Showing with 32 additions and 0 deletions.
  1. +15 −0 js_no_stream/run.js
  2. +17 −0 ruby_yajl/run.rb
View
15 js_no_stream/run.js
@@ -0,0 +1,15 @@
+#!/usr/local/bin/node
+var fs = require('fs');
+var jsonFile = process.argv[2]; //File name sent in from the marshaller
+
+console.time("Parse");
+
+var parsedJSON = require("." + jsonFile);
+var rows = parsedJSON["rows"];
+
+var total_rows = 0;
+for (var i=0; i< rows.length; i++){
+ total_rows++;
+}
+
+console.timeEnd("Parse");
View
17 ruby_yajl/run.rb
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+require 'yajl'
+beginning_time = Time.now
+
+total_rows = 0
+json = File.new(ARGV[0], 'r')
+parser = Yajl::Parser.new
+parser.parse(json) do |hash|
+ root = hash["rows"]
+ root.each do |row|
+ total_rows+=1
+ end
+end
+
+end_time = Time.now
+
+puts "Parse: #{((end_time - beginning_time)*1000).ceil}ms"

0 comments on commit b3e3a17

Please sign in to comment.
Something went wrong with that request. Please try again.