edn_turbo 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -40
- data/ext/edn_turbo/edn_parser.cc +1651 -1529
- data/ext/edn_turbo/edn_parser.h +15 -12
- data/ext/edn_turbo/edn_parser.rl +375 -327
- data/ext/edn_turbo/edn_parser_unicode.cc +1 -1
- data/ext/edn_turbo/{edn_parser_def.cc → edn_parser_util.cc} +23 -15
- data/lib/edn_turbo/version.rb +2 -2
- data/test/test_output_diff.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a70e4427453a794f2ccaac6034998708b9784a7d
|
4
|
+
data.tar.gz: d7fe39621793765d1aabe054d68fe11ecaf39efa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbe5d42a67406237809cae635bd33d036a33fdf936fce7e2d80e767f4094ad7e056d5a4e6097c723a7177156e1064aed090b862985d319111bda1a613b585d14
|
7
|
+
data.tar.gz: c8dd167e57663ab45837b89dd6034b8e151f5d1b18d6abd853fb1dc842473a1267bdadc3c01aa8a9063fd9aa43df50dfd568088aef12844e3f103ccdfb214f52
|
data/README.md
CHANGED
@@ -5,45 +5,26 @@ Ruby C-extension for parsing EDN files.
|
|
5
5
|
|
6
6
|
Written based on the functionality of
|
7
7
|
[edn](https://github.com/relevance/edn-ruby) but with the goal of
|
8
|
-
achieving much faster parsing.
|
8
|
+
achieving much faster parsing.
|
9
9
|
|
10
10
|
As of v0.2.0, `edn_turbo` requires `edn` to support tagged elements
|
11
|
-
using a similar API and return types.
|
11
|
+
using a similar API and return types. Eventually, I'd like to bundle
|
12
12
|
`edn_turbo` as an optional parser for `edn`.
|
13
13
|
|
14
14
|
Some quick sample runs comparing time output of file reads using `edn`
|
15
|
-
and `edn_turbo
|
15
|
+
and `edn_turbo` (see [issue 12](https://github.com/relevance/edn-ruby/issues/12)):
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
real 0m0.132s
|
29
|
-
user 0m0.091s
|
30
|
-
sys 0m0.038s
|
31
|
-
```
|
32
|
-
|
33
|
-
2. 43M data file:
|
34
|
-
|
35
|
-
```
|
36
|
-
with edn
|
37
|
-
|
38
|
-
real 0m55.922s
|
39
|
-
user 0m55.155s
|
40
|
-
sys 0m0.339s
|
41
|
-
|
42
|
-
with edn_turbo
|
43
|
-
|
44
|
-
real 0m1.976s
|
45
|
-
user 0m1.844s
|
46
|
-
sys 0m0.111s
|
17
|
+
```ruby
|
18
|
+
irb(main):004:0> s = "[{\"x\" {\"id\" \"/model/952\", \"model_name\" \"person\", \"ancestors\" [\"record\" \"asset\"], \"format\" \"edn\"}, \"id\" 952, \"name\" nil, \"model_name\" \"person\", \"rel\" {}, \"description\" nil, \"age\" nil, \"updated_at\" nil, \"created_at\" nil, \"anniversary\" nil, \"job\" nil, \"start_date\" nil, \"username\" nil, \"vacation_start\" nil, \"vacation_end\" nil, \"expenses\" nil, \"rate\" nil, \"display_name\" nil, \"gross_profit_per_month\" nil}]"
|
19
|
+
=> "[{\"x\" {\"id\" \"/model/952\", \"model_name\" \"person\", \"ancestors\" [\"record\" \"asset\"], \"format\" \"edn\"}, \"id\" 952, \"name\" nil, \"model_name\" \"person\", \"rel\" {}, \"description\" nil, \"age\" nil, \"updated_at\" nil, \"created_at\" nil, \"anniversary\" nil, \"job\" nil, \"start_date\" nil, \"username\" nil, \"vacation_start\" nil, \"vacation_end\" nil, \"expenses\" nil, \"rate\" nil, \"display_name\" nil, \"gross_profit_per_month\" nil}]"
|
20
|
+
irb(main):005:0> Benchmark.realtime { 100.times { EDN::read(s) } }
|
21
|
+
=> 0.08602
|
22
|
+
irb(main):006:0> Benchmark.realtime { 100.times { EDNT::read(s) } }
|
23
|
+
=> 0.005923
|
24
|
+
irb(main):007:0> Benchmark.realtime { 100000.times { EDN::read(s) } }
|
25
|
+
=> 81.185499
|
26
|
+
irb(main):008:0> Benchmark.realtime { 100000.times { EDNT::read(s) } }
|
27
|
+
=> 3.929506
|
47
28
|
```
|
48
29
|
|
49
30
|
Dependencies
|
@@ -72,11 +53,6 @@ Usage
|
|
72
53
|
|
73
54
|
Known problems
|
74
55
|
==============
|
75
|
-
|
56
|
+
v0.2.2:
|
76
57
|
|
77
|
-
- Need to
|
78
|
-
symbols with a leading `-`. The current set of parsers expect only
|
79
|
-
numeric values to optionally lead with a `-` so support for the
|
80
|
-
other two cases requires refactoring of the parser logic
|
81
|
-
- Need to check handling of discards at the root level. Discards
|
82
|
-
within containers looks to work 100% as far as I know.
|
58
|
+
- Need to emulate EDN::Reader.each
|