Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
110 additions
and
3 deletions.
There are no files selected for viewing
77 changes: 77 additions & 0 deletions
77
benchmark/clearley/benchmark/json/small-test-formatted.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
|
||
{ | ||
"id_str": "150739698292244480", | ||
"entities": { | ||
"hashtags": [], | ||
"urls": [ | ||
{ | ||
"url": "http://t.co/sEXkB2zC", | ||
"indices": [ | ||
76, | ||
96 | ||
], | ||
"expanded_url": "http://fb.me/XIaFd0yI", | ||
"display_url": "fb.me/XIaFd0yI" | ||
} | ||
], | ||
"user_mentions": [] | ||
}, | ||
"in_reply_to_status_id": null, | ||
"contributors": null, | ||
"place": null, | ||
"truncated": false, | ||
"geo": null, | ||
"favorited": false, | ||
"created_at": "Sun Dec 25 00:48:39 +0000 2011", | ||
"user": { | ||
"id_str": "8394862", | ||
"contributors_enabled": false, | ||
"lang": "en", | ||
"protected": false, | ||
"url": "http://mrgray.com/$", | ||
"profile_use_background_image": true, | ||
"name": "mralexgray", | ||
"default_profile_image": false, | ||
"friends_count": 306, | ||
"profile_text_color": "D95B43", | ||
"statuses_count": 63, | ||
"profile_background_image_url": "http://a2.twimg.com/profile_background_images/88810365/x86b7f9c12df0fa38ce1a4f29b759706.png", | ||
"utc_offset": -18000, | ||
"description": "Fierceness Incarnate", | ||
"is_translator": false, | ||
"created_at": "Fri Aug 24 01:00:57 +0000 2007", | ||
"profile_link_color": "C02942", | ||
"following": null, | ||
"profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/88810365/x86b7f9c12df0fa38ce1a4f29b759706.png", | ||
"favourites_count": 4, | ||
"follow_request_sent": null, | ||
"geo_enabled": true, | ||
"profile_background_color": "53777A", | ||
"profile_background_tile": true, | ||
"followers_count": 121, | ||
"profile_image_url": "http://a2.twimg.com/profile_images/21449002/Yo.I.Ain_t.Barbie_normal.jpg", | ||
"screen_name": "mralexgray", | ||
"show_all_inline_media": true, | ||
"profile_sidebar_fill_color": "ECD078", | ||
"profile_image_url_https": "https://si0.twimg.com/profile_images/21449002/Yo.I.Ain_t.Barbie_normal.jpg", | ||
"listed_count": 1, | ||
"notifications": null, | ||
"location": "NYC", | ||
"id": 8394862, | ||
"default_profile": false, | ||
"verified": false, | ||
"time_zone": "Quito", | ||
"profile_sidebar_border_color": "542437" | ||
}, | ||
"in_reply_to_user_id": null, | ||
"retweet_count": 0, | ||
"in_reply_to_screen_name": null, | ||
"in_reply_to_status_id_str": null, | ||
"possibly_sensitive": false, | ||
"retweeted": false, | ||
"source": "<a href=\"http://www.facebook.com/twitter\" rel=\"nofollow\">Facebook</a>", | ||
"in_reply_to_user_id_str": null, | ||
"coordinates": null, | ||
"id": 150739698292244480, | ||
"text": "let me put my hands together…. my thumbs were broken in an acting accident. http://t.co/sEXkB2zC" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "id_str": "150739698292244480", "entities": { "hashtags": [], "urls": [ { "url": "http://t.co/sEXkB2zC", "indices": [ 76, 96 ], "expanded_url": "http://fb.me/XIaFd0yI", "display_url": "fb.me/XIaFd0yI" } ], "user_mentions": [] }, "in_reply_to_status_id": null, "contributors": null, "place": null, "truncated": false, "geo": null, "favorited": false, "created_at": "Sun Dec 25 00:48:39 +0000 2011", "user": { "id_str": "8394862", "contributors_enabled": false, "lang": "en", "protected": false, "url": "http://mrgray.com/$", "profile_use_background_image": true, "name": "mralexgray", "default_profile_image": false, "friends_count": 306, "profile_text_color": "D95B43", "statuses_count": 63, "profile_background_image_url": "http://a2.twimg.com/profile_background_images/88810365/x86b7f9c12df0fa38ce1a4f29b759706.png", "utc_offset": -18000, "description": "Fierceness Incarnate", "is_translator": false, "created_at": "Fri Aug 24 01:00:57 +0000 2007", "profile_link_color": "C02942", "following": null, "profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/88810365/x86b7f9c12df0fa38ce1a4f29b759706.png", "favourites_count": 4, "follow_request_sent": null, "geo_enabled": true, "profile_background_color": "53777A", "profile_background_tile": true, "followers_count": 121, "profile_image_url": "http://a2.twimg.com/profile_images/21449002/Yo.I.Ain_t.Barbie_normal.jpg", "screen_name": "mralexgray", "show_all_inline_media": true, "profile_sidebar_fill_color": "ECD078", "profile_image_url_https": "https://si0.twimg.com/profile_images/21449002/Yo.I.Ain_t.Barbie_normal.jpg", "listed_count": 1, "notifications": null, "location": "NYC", "id": 8394862, "default_profile": false, "verified": false, "time_zone": "Quito", "profile_sidebar_border_color": "542437" }, "in_reply_to_user_id": null, "retweet_count": 0, "in_reply_to_screen_name": null, "in_reply_to_status_id_str": null, "possibly_sensitive": false, "retweeted": false, "source": "<a href=\"http://www.facebook.com/twitter\" rel=\"nofollow\">Facebook</a>", "in_reply_to_user_id_str": null, "coordinates": null, "id": 150739698292244480, "text": "let me put my hands together…. my thumbs were broken in an acting accident. http://t.co/sEXkB2zC" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
(ns clearley.benchmark.json.test | ||
(require [clojure.java.io :as io] | ||
[clearley.examples.json :as json]) | ||
(use [clearley core] | ||
[criterium core])) | ||
|
||
(def prefix "clearley/benchmark/json/") | ||
|
||
(defn bench-parser [filename] | ||
(println "Loading" filename "into memory") | ||
(let [loaded-file (-> (str prefix filename) | ||
io/resource io/reader slurp)] | ||
(println "Chars loaded:" (count loaded-file)) | ||
(println "Benchmarking") | ||
(bench (parse json/json-parser loaded-file)))) | ||
|
||
(defn -main [& args] | ||
(bench-parser "small-test.json") | ||
; With no lookahead, each consecutive space adds O(1) ambiguity | ||
(bench-parser "small-test-formatted.json") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters