json_pure 1.2.4 → 1.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +32 -0
- data/README +14 -18
- data/Rakefile +19 -14
- data/VERSION +1 -1
- data/benchmarks/generator2_benchmark.rb +222 -0
- data/benchmarks/generator_benchmark.rb +63 -4
- data/benchmarks/ohai.json +1216 -0
- data/benchmarks/ohai.ruby +1 -0
- data/benchmarks/parser2_benchmark.rb +251 -0
- data/benchmarks/parser_benchmark.rb +52 -4
- data/ext/json/ext/generator/extconf.rb +14 -5
- data/ext/json/ext/generator/generator.c +880 -416
- data/ext/json/ext/generator/generator.h +197 -0
- data/ext/json/ext/parser/extconf.rb +8 -4
- data/ext/json/ext/parser/parser.c +225 -183
- data/ext/json/ext/parser/parser.h +71 -0
- data/ext/json/ext/parser/parser.rl +151 -109
- data/lib/json/common.rb +53 -42
- data/lib/json/pure/generator.rb +111 -120
- data/lib/json/pure/parser.rb +29 -27
- data/lib/json/version.rb +1 -1
- data/tests/test_json.rb +70 -3
- data/tests/test_json_addition.rb +6 -6
- data/tests/test_json_encoding.rb +4 -3
- data/tests/test_json_generate.rb +66 -7
- data/tests/test_json_unicode.rb +20 -6
- metadata +10 -8
- data/ext/json/ext/generator/unicode.c +0 -180
- data/ext/json/ext/generator/unicode.h +0 -53
- data/ext/json/ext/parser/unicode.c +0 -154
- data/ext/json/ext/parser/unicode.h +0 -58
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"kernel"=>{"name"=>"Darwin", "machine"=>"i386", "modules"=>{"com.apple.driver.AppleAPIC"=>{"size"=>12288, "version"=>"1.4", "index"=>"26", "refcount"=>"0"}, "com.apple.driver.AirPort.Atheros"=>{"size"=>593920, "version"=>"318.8.3", "index"=>"88", "refcount"=>"0"}, "com.apple.driver.AppleIntelCPUPowerManagement"=>{"size"=>102400, "version"=>"59.0.1", "index"=>"22", "refcount"=>"0"}, "com.apple.iokit.IOStorageFamily"=>{"size"=>98304, "version"=>"1.5.5", "index"=>"44", "refcount"=>"9"}, "com.apple.iokit.IOATAPIProtocolTransport"=>{"size"=>16384, "version"=>"1.5.2", "index"=>"52", "refcount"=>"0"}, "com.apple.iokit.IOPCIFamily"=>{"size"=>65536, "version"=>"2.5", "index"=>"17", "refcount"=>"18"}, "org.virtualbox.kext.VBoxDrv"=>{"size"=>118784, "version"=>"2.2.0", "index"=>"114", "refcount"=>"3"}, "com.cisco.nke.ipsec"=>{"size"=>454656, "version"=>"2.0.1", "index"=>"111", "refcount"=>"0"}, "com.apple.driver.AppleHPET"=>{"size"=>12288, "version"=>"1.3", "index"=>"33", "refcount"=>"0"}, "com.apple.driver.AppleUSBHub"=>{"size"=>49152, "version"=>"3.2.7", "index"=>"47", "refcount"=>"0"}, "com.apple.iokit.IOFireWireFamily"=>{"size"=>258048, "version"=>"3.4.6", "index"=>"49", "refcount"=>"2"}, "com.apple.driver.AppleUSBComposite"=>{"size"=>16384, "version"=>"3.2.0", "index"=>"60", "refcount"=>"1"}, "com.apple.driver.AppleIntelPIIXATA"=>{"size"=>36864, "version"=>"2.0.0", "index"=>"41", "refcount"=>"0"}, "com.apple.driver.AppleSmartBatteryManager"=>{"size"=>28672, "version"=>"158.6.0", "index"=>"32", "refcount"=>"0"}, "com.apple.filesystems.udf"=>{"size"=>233472, "version"=>"2.0.2", "index"=>"119", "refcount"=>"0"}, "com.apple.iokit.IOSMBusFamily"=>{"size"=>12288, "version"=>"1.1", "index"=>"27", "refcount"=>"2"}, "com.apple.iokit.IOACPIFamily"=>{"size"=>16384, "version"=>"1.2.0", "index"=>"18", "refcount"=>"10"}, "foo.tap"=>{"size"=>24576, "version"=>"1.0", "index"=>"113", "refcount"=>"0"}, "com.vmware.kext.vmx86"=>{"size"=>864256, "version"=>"2.0.4", "index"=>"104", "refcount"=>"0"}, "com.apple.iokit.CHUDUtils"=>{"size"=>28672, "version"=>"200", "index"=>"98", "refcount"=>"0"}, "com.apple.driver.AppleACPIButtons"=>{"size"=>16384, "version"=>"1.2.4", "index"=>"30", "refcount"=>"0"}, "com.apple.driver.AppleFWOHCI"=>{"size"=>139264, "version"=>"3.7.2", "index"=>"50", "refcount"=>"0"}, "com.apple.iokit.IOSCSIArchitectureModelFamily"=>{"size"=>102400, "version"=>"2.0.5", "index"=>"51", "refcount"=>"4"}, "org.virtualbox.kext.VBoxNetAdp"=>{"size"=>8192, "version"=>"2.2.0", "index"=>"117", "refcount"=>"0"}, "com.apple.filesystems.autofs"=>{"size"=>45056, "version"=>"2.0.1", "index"=>"109", "refcount"=>"0"}, "com.vmware.kext.vmnet"=>{"size"=>36864, "version"=>"2.0.4", "index"=>"108", "refcount"=>"0"}, "com.apple.iokit.IOSCSIBlockCommandsDevice"=>{"size"=>90112, "version"=>"2.0.5", "index"=>"57", "refcount"=>"1"}, "com.apple.driver.AppleACPIPCI"=>{"size"=>12288, "version"=>"1.2.4", "index"=>"31", "refcount"=>"0"}, "com.apple.security.seatbelt"=>{"size"=>98304, "version"=>"107.10", "index"=>"25", "refcount"=>"0"}, "com.apple.driver.AppleUpstreamUserClient"=>{"size"=>16384, "version"=>"2.7.2", "index"=>"100", "refcount"=>"0"}, "com.apple.kext.OSvKernDSPLib"=>{"size"=>12288, "version"=>"1.1", "index"=>"79", "refcount"=>"1"}, "com.apple.iokit.IOBDStorageFamily"=>{"size"=>20480, "version"=>"1.5", "index"=>"58", "refcount"=>"1"}, "com.apple.iokit.IOGraphicsFamily"=>{"size"=>118784, "version"=>"1.7.1", "index"=>"70", "refcount"=>"5"}, "com.apple.iokit.IONetworkingFamily"=>{"size"=>90112, "version"=>"1.6.1", "index"=>"82", "refcount"=>"4"}, "com.apple.iokit.IOATAFamily"=>{"size"=>53248, "version"=>"2.0.0", "index"=>"40", "refcount"=>"2"}, "com.apple.iokit.IOUSBHIDDriver"=>{"size"=>20480, "version"=>"3.2.2", "index"=>"63", "refcount"=>"2"}, "org.virtualbox.kext.VBoxUSB"=>{"size"=>28672, "version"=>"2.2.0", "index"=>"115", "refcount"=>"0"}, "com.apple.security.TMSafetyNet"=>{"size"=>12288, "version"=>"3", "index"=>"23", "refcount"=>"0"}, "com.apple.iokit.IONDRVSupport"=>{"size"=>57344, "version"=>"1.7.1", "index"=>"71", "refcount"=>"3"}, "com.apple.BootCache"=>{"size"=>20480, "version"=>"30.3", "index"=>"20", "refcount"=>"0"}, "com.vmware.kext.vmioplug"=>{"size"=>24576, "version"=>"2.0.4", "index"=>"107", "refcount"=>"0"}, "com.apple.iokit.IOUSBUserClient"=>{"size"=>8192, "version"=>"3.2.4", "index"=>"46", "refcount"=>"1"}, "com.apple.iokit.IOSCSIMultimediaCommandsDevice"=>{"size"=>90112, "version"=>"2.0.5", "index"=>"59", "refcount"=>"0"}, "com.apple.driver.AppleIRController"=>{"size"=>20480, "version"=>"110", "index"=>"78", "refcount"=>"0"}, "com.apple.driver.AudioIPCDriver"=>{"size"=>16384, "version"=>"1.0.5", "index"=>"81", "refcount"=>"0"}, "com.apple.driver.AppleLPC"=>{"size"=>12288, "version"=>"1.2.11", "index"=>"73", "refcount"=>"0"}, "org.virtualbox.kext.VBoxNetFlt"=>{"size"=>16384, "version"=>"2.2.0", "index"=>"116", "refcount"=>"0"}, "com.apple.iokit.CHUDKernLib"=>{"size"=>20480, "version"=>"196", "index"=>"93", "refcount"=>"2"}, "com.apple.iokit.CHUDProf"=>{"size"=>49152, "version"=>"207", "index"=>"97", "refcount"=>"0"}, "com.apple.NVDAResman"=>{"size"=>2478080, "version"=>"5.3.6", "index"=>"90", "refcount"=>"2"}, "com.apple.driver.AppleACPIEC"=>{"size"=>20480, "version"=>"1.2.4", "index"=>"28", "refcount"=>"0"}, "foo.tun"=>{"size"=>24576, "version"=>"1.0", "index"=>"118", "refcount"=>"0"}, "com.apple.iokit.IOSerialFamily"=>{"size"=>36864, "version"=>"9.3", "index"=>"102", "refcount"=>"1"}, "com.apple.GeForce"=>{"size"=>622592, "version"=>"5.3.6", "index"=>"96", "refcount"=>"0"}, "com.apple.iokit.IOCDStorageFamily"=>{"size"=>32768, "version"=>"1.5", "index"=>"55", "refcount"=>"3"}, "com.apple.driver.AppleUSBEHCI"=>{"size"=>73728, "version"=>"3.2.5", "index"=>"39", "refcount"=>"0"}, "com.apple.nvidia.nv50hal"=>{"size"=>2445312, "version"=>"5.3.6", "index"=>"91", "refcount"=>"0"}, "com.apple.driver.AppleSMBIOS"=>{"size"=>16384, "version"=>"1.1.1", "index"=>"29", "refcount"=>"0"}, "com.apple.driver.AppleBacklight"=>{"size"=>16384, "version"=>"1.4.4", "index"=>"72", "refcount"=>"0"}, "com.apple.driver.AppleACPIPlatform"=>{"size"=>253952, "version"=>"1.2.4", "index"=>"19", "refcount"=>"3"}, "com.apple.iokit.SCSITaskUserClient"=>{"size"=>24576, "version"=>"2.0.5", "index"=>"54", "refcount"=>"0"}, "com.apple.iokit.IOHIDFamily"=>{"size"=>233472, "version"=>"1.5.3", "index"=>"21", "refcount"=>"7"}, "com.apple.driver.DiskImages"=>{"size"=>65536, "version"=>"195.2.2", "index"=>"101", "refcount"=>"0"}, "com.apple.iokit.IODVDStorageFamily"=>{"size"=>24576, "version"=>"1.5", "index"=>"56", "refcount"=>"2"}, "com.apple.iokit.IOFireWireIP"=>{"size"=>36864, "version"=>"1.7.6", "index"=>"83", "refcount"=>"0"}, "com.apple.driver.AppleRTC"=>{"size"=>20480, "version"=>"1.2.3", "index"=>"34", "refcount"=>"0"}, "com.apple.driver.XsanFilter"=>{"size"=>20480, "version"=>"2.7.91", "index"=>"53", "refcount"=>"0"}, "com.apple.driver.AppleEFIRuntime"=>{"size"=>12288, "version"=>"1.2.0", "index"=>"35", "refcount"=>"1"}, "com.apple.iokit.IOAHCIBlockStorage"=>{"size"=>69632, "version"=>"1.2.0", "index"=>"48", "refcount"=>"0"}, "com.apple.nke.applicationfirewall"=>{"size"=>32768, "version"=>"1.0.77", "index"=>"24", "refcount"=>"0"}, "com.apple.iokit.IO80211Family"=>{"size"=>126976, "version"=>"215.1", "index"=>"87", "refcount"=>"1"}, "com.vmware.kext.vmci"=>{"size"=>45056, "version"=>"2.0.4", "index"=>"106", "refcount"=>"0"}, "com.apple.iokit.IOAHCIFamily"=>{"size"=>24576, "version"=>"1.5.0", "index"=>"42", "refcount"=>"2"}, "com.apple.driver.AppleUSBUHCI"=>{"size"=>57344, "version"=>"3.2.5", "index"=>"38", "refcount"=>"0"}, "com.apple.driver.AppleUSBMergeNub"=>{"size"=>12288, "version"=>"3.2.4", "index"=>"61", "refcount"=>"0"}, "com.apple.iokit.IOUSBFamily"=>{"size"=>167936, "version"=>"3.2.7", "index"=>"37", "refcount"=>"13"}, "com.apple.driver.AppleEFINVRAM"=>{"size"=>24576, "version"=>"1.2.0", "index"=>"36", "refcount"=>"0"}, "com.apple.driver.AppleAHCIPort"=>{"size"=>53248, "version"=>"1.5.2", "index"=>"43", "refcount"=>"0"}}, "os"=>"Darwin", "version"=>"Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386", "release"=>"9.6.0"}, "command"=>{"ps"=>"ps -ef"}, "platform"=>"mac_os_x", "platform_version"=>"10.5.6", "keys"=>{"ssh"=>{"host_dsa_public"=>"private", "host_rsa_public"=>"private"}}, "ipaddress"=>"192.168.88.1", "fqdn"=>"local.local", "network"=>{"settings"=>{"net.inet6.ip6.forwarding"=>"0", "net.inet.ip.dummynet.debug"=>"0", "net.inet.ip.rtexpire"=>"10", "net.inet6.ipsec6.esp_trans_deflev"=>"1", "net.inet.tcp.tcbhashsize"=>"4096", "net.key.esp_auth"=>"0", "net.inet6.ip6.hlim"=>"64", "net.inet.ip.fw.dyn_fin_lifetime"=>"1", "net.inet.ip.fw.dyn_udp_lifetime"=>"10", "net.inet.icmp.bmcastecho"=>"1", "net.athbgscan"=>"1 1", "net.inet.tcp.reass.maxsegments"=>"2048", "net.athforceBias"=>"2 2", "net.inet6.ip6.auto_flowlabel"=>"1", "net.inet6.ip6.rtmaxcache"=>"128", "net.inet.tcp.sendspace"=>"131072", "net.inet.tcp.keepinit"=>"75000", "net.inet.ip.dummynet.max_chain_len"=>"16", "net.inet.tcp.rfc1644"=>"0", "net.inet.ip.fw.curr_dyn_buckets"=>"256", "net.inet.ip.dummynet.ready_heap"=>"0", "net.inet.ip.portrange.first"=>"49152", "net.inet.tcp.background_io_trigger"=>"5", "net.link.ether.inet.host_down_time"=>"20", "net.inet6.ipsec6.def_policy"=>"1", "net.inet6.ipsec6.ecn"=>"0", "net.inet.ip.fastforwarding"=>"0", "net.inet6.ip6.v6only"=>"0", "net.inet.tcp.sack"=>"1", "net.inet6.ip6.rtexpire"=>"3600", "net.link.ether.inet.proxyall"=>"0", "net.athaddbaignore"=>"0 0", "net.inet6.ip6.keepfaith"=>"0", "net.key.spi_trycnt"=>"1000", "net.link.ether.inet.prune_intvl"=>"300", "net.inet.tcp.ecn_initiate_out"=>"0", "net.inet.ip.fw.dyn_rst_lifetime"=>"1", "net.local.stream.sendspace"=>"8192", "net.inet.tcp.socket_unlocked_on_output"=>"1", "net.inet.ip.fw.verbose_limit"=>"0", "net.local.dgram.recvspace"=>"4096", "net.inet.ipsec.debug"=>"0", "net.link.ether.inet.log_arp_warnings"=>"0", "net.inet.tcp.ecn_negotiate_in"=>"0", "net.inet.tcp.rfc3465"=>"1", "net.inet.tcp.icmp_may_rst"=>"1", "net.link.ether.inet.sendllconflict"=>"0", "net.inet.ipsec.ah_offsetmask"=>"0", "net.key.blockacq_count"=>"10", "net.inet.tcp.delayed_ack"=>"3", "net.inet.ip.fw.verbose"=>"2", "net.inet.ip.fw.dyn_count"=>"0", "net.inet.tcp.slowlink_wsize"=>"8192", "net.inet6.ip6.fw.enable"=>"1", "net.inet.ip.portrange.hilast"=>"65535", "net.inet.icmp.maskrepl"=>"0", "net.link.ether.inet.apple_hwcksum_rx"=>"1", "net.inet.tcp.drop_synfin"=>"1", "net.key.spi_maxval"=>"268435455", "net.inet.ipsec.ecn"=>"0", "net.inet.ip.fw.dyn_keepalive"=>"1", "net.key.int_random"=>"60", "net.key.debug"=>"0", "net.inet.ip.dummynet.curr_time"=>"0", "net.inet.udp.blackhole"=>"0", "net.athaggrqmin"=>"1 1", "net.inet.ip.fw.dyn_syn_lifetime"=>"20", "net.inet.tcp.keepidle"=>"7200000", "net.inet6.ip6.tempvltime"=>"604800", "net.inet.tcp.recvspace"=>"358400", "net.inet.udp.maxdgram"=>"9216", "net.inet.tcp.keepintvl"=>"75000", "net.inet.ip.maxchainsent"=>"0", "net.athppmenable"=>"1 1", "net.inet.ipsec.esp_net_deflev"=>"1", "net.inet6.icmp6.nd6_useloopback"=>"1", "net.inet.tcp.slowstart_flightsize"=>"1", "net.inet.ip.fw.debug"=>"0", "net.inet.ip.linklocal.in.allowbadttl"=>"1", "net.key.spi_minval"=>"256", "net.inet.ip.forwarding"=>"0", "net.inet.tcp.v6mssdflt"=>"1024", "net.key.larval_lifetime"=>"30", "net.inet6.ip6.fw.verbose_limit"=>"0", "net.inet.ip.dummynet.red_lookup_depth"=>"256", "net.inet.tcp.pcbcount"=>"36", "net.inet.ip.fw.dyn_ack_lifetime"=>"300", "net.athCCAThreshold"=>"28 28", "net.inet.ip.portrange.lowlast"=>"600", "net.link.ether.inet.useloopback"=>"1", "net.athqdepth"=>"0 0", "net.inet.ip.ttl"=>"64", "net.inet.ip.rtmaxcache"=>"128", "net.inet.ipsec.bypass"=>"0", "net.inet6.icmp6.nd6_debug"=>"0", "net.inet.ip.use_route_genid"=>"1", "net.inet6.icmp6.rediraccept"=>"1", "net.inet.ip.fw.static_count"=>"1", "net.inet6.ip6.fw.debug"=>"0", "net.inet.udp.pcbcount"=>"104", "net.inet.ipsec.esp_randpad"=>"-1", "net.inet6.icmp6.nd6_maxnudhint"=>"0", "net.inet.tcp.always_keepalive"=>"0", "net.inet.udp.checksum"=>"1", "net.link.ether.inet.keep_announcements"=>"1", "net.athfixedDropThresh"=>"150 150", "net.inet6.ip6.kame_version"=>"20010528/apple-darwin", "net.inet.ip.fw.dyn_max"=>"4096", "net.inet.udp.log_in_vain"=>"0", "net.inet6.icmp6.nd6_mmaxtries"=>"3", "net.inet.ip.rtminexpire"=>"10", "net.inet.ip.fw.dyn_buckets"=>"256", "net.inet6.ip6.accept_rtadv"=>"0", "net.inet6.ip6.rr_prune"=>"5", "net.key.ah_keymin"=>"128", "net.inet.ip.redirect"=>"1", "net.inet.tcp.sack_globalmaxholes"=>"65536", "net.inet.ip.keepfaith"=>"0", "net.inet.ip.dummynet.expire"=>"1", "net.inet.ip.gifttl"=>"30", "net.inet.ip.portrange.last"=>"65535", "net.inet.ipsec.ah_net_deflev"=>"1", "net.inet6.icmp6.nd6_delay"=>"5", "net.inet.tcp.packetchain"=>"50", "net.inet6.ip6.hdrnestlimit"=>"50", "net.inet.tcp.newreno"=>"0", "net.inet6.ip6.dad_count"=>"1", "net.inet6.ip6.auto_linklocal"=>"1", "net.inet6.ip6.temppltime"=>"86400", "net.inet.tcp.strict_rfc1948"=>"0", "net.inet.ip.dummynet.red_max_pkt_size"=>"1500", "net.inet.ip.maxfrags"=>"2048", "net.inet.tcp.log_in_vain"=>"0", "net.athdupie"=>"1 1", "net.inet.tcp.rfc1323"=>"1", "net.inet.ip.subnets_are_local"=>"0", "net.inet.ip.dummynet.search_steps"=>"0", "net.inet.icmp.icmplim"=>"250", "net.link.ether.inet.apple_hwcksum_tx"=>"1", "net.inet6.icmp6.redirtimeout"=>"600", "net.inet.ipsec.ah_cleartos"=>"1", "net.inet6.ip6.log_interval"=>"5", "net.link.ether.inet.max_age"=>"1200", "net.inet.ip.fw.enable"=>"1", "net.inet6.ip6.redirect"=>"1", "net.athaggrfmax"=>"28 28", "net.inet.ip.maxfragsperpacket"=>"128", "net.inet6.ip6.use_deprecated"=>"1", "net.link.generic.system.dlil_input_sanity_check"=>"0", "net.inet.tcp.sack_globalholes"=>"0", "net.inet.tcp.reass.cursegments"=>"0", "net.inet6.icmp6.nodeinfo"=>"3", "net.local.inflight"=>"0", "net.inet.ip.dummynet.hash_size"=>"64", "net.inet.ip.dummynet.red_avg_pkt_size"=>"512", "net.inet.ipsec.dfbit"=>"0", "net.inet.tcp.reass.overflows"=>"0", "net.inet.tcp.rexmt_thresh"=>"2", "net.inet6.ip6.maxfrags"=>"8192", "net.inet6.ip6.rtminexpire"=>"10", "net.inet6.ipsec6.esp_net_deflev"=>"1", "net.inet.tcp.blackhole"=>"0", "net.key.esp_keymin"=>"256", "net.inet.ip.check_interface"=>"0", "net.inet.tcp.minmssoverload"=>"0", "net.link.ether.inet.maxtries"=>"5", "net.inet.tcp.do_tcpdrain"=>"0", "net.inet.ipsec.esp_port"=>"4500", "net.inet6.ipsec6.ah_net_deflev"=>"1", "net.inet.ip.dummynet.extract_heap"=>"0", "net.inet.tcp.path_mtu_discovery"=>"1", "net.inet.ip.intr_queue_maxlen"=>"50", "net.inet.ipsec.def_policy"=>"1", "net.inet.ip.fw.autoinc_step"=>"100", "net.inet.ip.accept_sourceroute"=>"0", "net.inet.raw.maxdgram"=>"8192", "net.inet.ip.maxfragpackets"=>"1024", "net.inet.ip.fw.one_pass"=>"0", "net.appletalk.routermix"=>"2000", "net.inet.tcp.tcp_lq_overflow"=>"1", "net.link.generic.system.ifcount"=>"9", "net.link.ether.inet.send_conflicting_probes"=>"1", "net.inet.tcp.background_io_enabled"=>"1", "net.inet6.ipsec6.debug"=>"0", "net.inet.tcp.win_scale_factor"=>"3", "net.key.natt_keepalive_interval"=>"20", "net.inet.tcp.msl"=>"15000", "net.inet.ip.portrange.hifirst"=>"49152", "net.inet.ipsec.ah_trans_deflev"=>"1", "net.inet.tcp.rtt_min"=>"1", "net.inet6.ip6.defmcasthlim"=>"1", "net.inet6.icmp6.nd6_prune"=>"1", "net.inet6.ip6.fw.verbose"=>"0", "net.inet.ip.portrange.lowfirst"=>"1023", "net.inet.tcp.maxseg_unacked"=>"8", "net.local.dgram.maxdgram"=>"2048", "net.key.blockacq_lifetime"=>"20", "net.inet.tcp.sack_maxholes"=>"128", "net.inet6.ip6.maxfragpackets"=>"1024", "net.inet6.ip6.use_tempaddr"=>"0", "net.athpowermode"=>"0 0", "net.inet.udp.recvspace"=>"73728", "net.inet.tcp.isn_reseed_interval"=>"0", "net.inet.tcp.local_slowstart_flightsize"=>"8", "net.inet.ip.dummynet.searches"=>"0", "net.inet.ip.intr_queue_drops"=>"0", "net.link.generic.system.multi_threaded_input"=>"1", "net.inet.raw.recvspace"=>"8192", "net.inet.ipsec.esp_trans_deflev"=>"1", "net.key.prefered_oldsa"=>"0", "net.local.stream.recvspace"=>"8192", "net.inet.tcp.sockthreshold"=>"64", "net.inet6.icmp6.nd6_umaxtries"=>"3", "net.pstimeout"=>"20 20", "net.inet.ip.sourceroute"=>"0", "net.inet.ip.fw.dyn_short_lifetime"=>"5", "net.inet.tcp.minmss"=>"216", "net.inet6.ip6.gifhlim"=>"0", "net.athvendorie"=>"1 1", "net.inet.ip.check_route_selfref"=>"1", "net.inet.icmp.log_redirect"=>"0", "net.inet6.icmp6.errppslimit"=>"100", "net.inet.tcp.mssdflt"=>"512", "net.inet.icmp.drop_redirect"=>"0", "net.inet6.ipsec6.esp_randpad"=>"-1", "net.inet6.ipsec6.ah_trans_deflev"=>"1", "net.inet.ip.random_id"=>"1", "net.inet.icmp.timestamp"=>"0"}, "interfaces"=>{"stf0"=>{"flags"=>[], "number"=>"0", "mtu"=>"1280", "type"=>"stf", "encapsulation"=>"6to4"}, "vmnet1"=>{"flags"=>["UP", "BROADCAST", "SMART", "RUNNING", "SIMPLEX", "MULTICAST"], "number"=>"1", "addresses"=>[{"broadcast"=>"192.168.88.255", "netmask"=>"255.255.255.0", "family"=>"inet", "address"=>"192.168.88.1"}, {"family"=>"lladdr", "address"=>"private"}], "mtu"=>"1500", "type"=>"vmnet", "encapsulation"=>"Ethernet"}, "vboxnet0"=>{"flags"=>["BROADCAST", "RUNNING", "SIMPLEX", "MULTICAST"], "number"=>"0", "addresses"=>[{"family"=>"lladdr", "address"=>"private"}], "mtu"=>"1500", "type"=>"vboxnet", "encapsulation"=>"Ethernet"}, "lo0"=>{"flags"=>["UP", "LOOPBACK", "RUNNING", "MULTICAST"], "number"=>"0", "addresses"=>[{"scope"=>"Link", "prefixlen"=>"64", "family"=>"inet6", "address"=>"fe80::1"}, {"netmask"=>"255.0.0.0", "family"=>"inet", "address"=>"127.0.0.1"}, {"scope"=>"Node", "prefixlen"=>"128", "family"=>"inet6", "address"=>"::1"}, {"scope"=>"Node", "prefixlen"=>"128", "family"=>"inet6", "address"=>"private"}], "mtu"=>"16384", "type"=>"lo", "encapsulation"=>"Loopback"}, "vboxn"=>{"counters"=>{"tx"=>{"packets"=>"0", "bytes"=>"0", "compressed"=>0, "collisions"=>"0", "carrier"=>0, "errors"=>"0", "drop"=>0, "overrun"=>0}, "rx"=>{"packets"=>"0", "bytes"=>"0", "compressed"=>0, "errors"=>"0", "drop"=>0, "overrun"=>0, "multicast"=>0, "frame"=>0}}}, "gif0"=>{"flags"=>["POINTOPOINT", "MULTICAST"], "number"=>"0", "mtu"=>"1280", "type"=>"gif", "encapsulation"=>"IPIP"}, "vmnet"=>{"counters"=>{"tx"=>{"packets"=>"0", "bytes"=>"0", "compressed"=>0, "collisions"=>"0", "carrier"=>0, "errors"=>"0", "drop"=>0, "overrun"=>0}, "rx"=>{"packets"=>"0", "bytes"=>"0", "compressed"=>0, "errors"=>"0", "drop"=>0, "overrun"=>0, "multicast"=>0, "frame"=>0}}}, "en0"=>{"flags"=>["UP", "BROADCAST", "SMART", "RUNNING", "SIMPLEX", "MULTICAST"], "status"=>"inactive", "number"=>"0", "addresses"=>[{"family"=>"lladdr", "address"=>"private"}], "mtu"=>"1500", "type"=>"en", "media"=>{"supported"=>[{"autoselect"=>{"options"=>[]}}, {"10baseT/UTP"=>{"options"=>["half-duplex"]}}, {"10baseT/UTP"=>{"options"=>["full-duplex"]}}, {"10baseT/UTP"=>{"options"=>["full-duplex", "hw-loopback"]}}, {"10baseT/UTP"=>{"options"=>["full-duplex", "flow-control"]}}, {"100baseTX"=>{"options"=>["half-duplex"]}}, {"100baseTX"=>{"options"=>["full-duplex"]}}, {"100baseTX"=>{"options"=>["full-duplex", "hw-loopback"]}}, {"100baseTX"=>{"options"=>["full-duplex", "flow-control"]}}, {"1000baseT"=>{"options"=>["full-duplex"]}}, {"1000baseT"=>{"options"=>["full-duplex", "hw-loopback"]}}, {"1000baseT"=>{"options"=>["full-duplex", "flow-control"]}}, {"none"=>{"options"=>[]}}], "selected"=>[{"autoselect"=>{"options"=>[]}}]}, "counters"=>{"tx"=>{"packets"=>"0", "bytes"=>"342", "compressed"=>0, "collisions"=>"0", "carrier"=>0, "errors"=>"0", "drop"=>0, "overrun"=>0}, "rx"=>{"packets"=>"0", "bytes"=>"0", "compressed"=>0, "errors"=>"0", "drop"=>0, "overrun"=>0, "multicast"=>0, "frame"=>0}}, "encapsulation"=>"Ethernet"}, "vmnet8"=>{"flags"=>["UP", "BROADCAST", "SMART", "RUNNING", "SIMPLEX", "MULTICAST"], "number"=>"8", "addresses"=>[{"broadcast"=>"192.168.237.255", "netmask"=>"255.255.255.0", "family"=>"inet", "address"=>"192.168.237.1"}, {"family"=>"lladdr", "address"=>"private"}], "mtu"=>"1500", "type"=>"vmnet", "encapsulation"=>"Ethernet"}, "en1"=>{"flags"=>["UP", "BROADCAST", "SMART", "RUNNING", "SIMPLEX", "MULTICAST"], "status"=>"active", "number"=>"1", "addresses"=>[{"scope"=>"Link", "prefixlen"=>"64", "family"=>"inet6", "address"=>"private"}, {"broadcast"=>"192.168.1.255", "netmask"=>"255.255.255.0", "family"=>"inet", "address"=>"192.168.1.4"}, {"family"=>"lladdr", "address"=>"private"}], "mtu"=>"1500", "type"=>"en", "media"=>{"supported"=>[{"autoselect"=>{"options"=>[]}}], "selected"=>[{"autoselect"=>{"options"=>[]}}]}, "counters"=>{"tx"=>{"packets"=>"7041789", "bytes"=>"449206298", "compressed"=>0, "collisions"=>"0", "carrier"=>0, "errors"=>"95", "drop"=>0, "overrun"=>0}, "rx"=>{"packets"=>"19966002", "bytes"=>"13673879120", "compressed"=>0, "errors"=>"1655893", "drop"=>0, "overrun"=>0, "multicast"=>0, "frame"=>0}}, "encapsulation"=>"Ethernet", "arp"=>{"192.168.1.7"=>"private"}}, "fw0"=>{"flags"=>["UP", "BROADCAST", "SMART", "RUNNING", "SIMPLEX", "MULTICAST"], "status"=>"inactive", "number"=>"0", "addresses"=>[{"family"=>"lladdr", "address"=>"private"}], "mtu"=>"4078", "type"=>"fw", "media"=>{"supported"=>[{"autoselect"=>{"options"=>["full-duplex"]}}], "selected"=>[{"autoselect"=>{"options"=>["full-duplex"]}}]}, "counters"=>{"tx"=>{"packets"=>"0", "bytes"=>"346", "compressed"=>0, "collisions"=>"0", "carrier"=>0, "errors"=>"0", "drop"=>0, "overrun"=>0}, "rx"=>{"packets"=>"0", "bytes"=>"0", "compressed"=>0, "errors"=>"0", "drop"=>0, "overrun"=>0, "multicast"=>0, "frame"=>0}}, "encapsulation"=>"1394"}}}, "os"=>"darwin", "domain"=>"local", "ohai_time"=>1240624355.08575, "platform_build"=>"9G55", "os_version"=>"9.6.0", "hostname"=>"local", "languages"=>{"ruby"=>{"target_os"=>"darwin9.0", "platform"=>"universal-darwin9.0", "host_vendor"=>"apple", "target_cpu"=>"i686", "target_vendor"=>"apple", "host_os"=>"darwin9.0", "version"=>"1.8.6", "host_cpu"=>"i686", "host"=>"i686-apple-darwin9.0", "release_date"=>"2008-03-03", "target"=>"i686-apple-darwin9.0"}}, "macaddress"=>"private"}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# CODING: UTF-8
|
|
3
|
+
|
|
4
|
+
require 'rbconfig'
|
|
5
|
+
RUBY_PATH=File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
|
|
6
|
+
RAKE_PATH=File.join(Config::CONFIG['bindir'], 'rake')
|
|
7
|
+
require 'bullshit'
|
|
8
|
+
case ARGV.first
|
|
9
|
+
when 'ext'
|
|
10
|
+
require 'json/ext'
|
|
11
|
+
when 'pure'
|
|
12
|
+
require 'json/pure'
|
|
13
|
+
when 'yaml'
|
|
14
|
+
require 'yaml'
|
|
15
|
+
require 'json/pure'
|
|
16
|
+
when 'rails'
|
|
17
|
+
require 'active_support'
|
|
18
|
+
require 'json/pure'
|
|
19
|
+
when 'yajl'
|
|
20
|
+
require 'yajl'
|
|
21
|
+
require 'json/pure'
|
|
22
|
+
else
|
|
23
|
+
require 'json/pure'
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
module Parser2BenchmarkCommon
|
|
27
|
+
include JSON
|
|
28
|
+
|
|
29
|
+
def setup
|
|
30
|
+
@big = @json = File.read(File.join(File.dirname(__FILE__), 'ohai.json'))
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def generic_reset_method
|
|
34
|
+
@result == @big or raise "not equal"
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
class Parser2BenchmarkExt < Bullshit::RepeatCase
|
|
39
|
+
include Parser2BenchmarkCommon
|
|
40
|
+
|
|
41
|
+
warmup yes
|
|
42
|
+
iterations 2000
|
|
43
|
+
|
|
44
|
+
truncate_data do
|
|
45
|
+
enabled false
|
|
46
|
+
alpha_level 0.05
|
|
47
|
+
window_size 50
|
|
48
|
+
slope_angle 0.1
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
autocorrelation do
|
|
52
|
+
alpha_level 0.05
|
|
53
|
+
max_lags 50
|
|
54
|
+
file yes
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
output_dir File.join(File.dirname(__FILE__), 'data')
|
|
58
|
+
output_filename benchmark_name + '.log'
|
|
59
|
+
data_file yes
|
|
60
|
+
histogram yes
|
|
61
|
+
|
|
62
|
+
def benchmark_parser
|
|
63
|
+
@result = JSON.parse(@json)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
alias reset_parser generic_reset_method
|
|
67
|
+
|
|
68
|
+
def benchmark_parser_symbolic
|
|
69
|
+
@result = JSON.parse(@json, :symbolize_names => true)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
alias reset_parser_symbolc generic_reset_method
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
class Parser2BenchmarkPure < Bullshit::RepeatCase
|
|
76
|
+
include Parser2BenchmarkCommon
|
|
77
|
+
|
|
78
|
+
warmup yes
|
|
79
|
+
iterations 400
|
|
80
|
+
|
|
81
|
+
truncate_data do
|
|
82
|
+
enabled false
|
|
83
|
+
alpha_level 0.05
|
|
84
|
+
window_size 50
|
|
85
|
+
slope_angle 0.1
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
autocorrelation do
|
|
89
|
+
alpha_level 0.05
|
|
90
|
+
max_lags 50
|
|
91
|
+
file yes
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
output_dir File.join(File.dirname(__FILE__), 'data')
|
|
95
|
+
output_filename benchmark_name + '.log'
|
|
96
|
+
data_file yes
|
|
97
|
+
histogram yes
|
|
98
|
+
|
|
99
|
+
def benchmark_parser
|
|
100
|
+
@result = JSON.parse(@json)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
alias reset_parser generic_reset_method
|
|
104
|
+
|
|
105
|
+
def benchmark_parser_symbolic
|
|
106
|
+
@result = JSON.parse(@json, :symbolize_names => true)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
alias reset_parser_symbolc generic_reset_method
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
class Parser2BenchmarkYAML < Bullshit::RepeatCase
|
|
113
|
+
warmup yes
|
|
114
|
+
iterations 400
|
|
115
|
+
|
|
116
|
+
truncate_data do
|
|
117
|
+
enabled false
|
|
118
|
+
alpha_level 0.05
|
|
119
|
+
window_size 50
|
|
120
|
+
slope_angle 0.1
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
autocorrelation do
|
|
124
|
+
alpha_level 0.05
|
|
125
|
+
max_lags 50
|
|
126
|
+
file yes
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
output_dir File.join(File.dirname(__FILE__), 'data')
|
|
130
|
+
output_filename benchmark_name + '.log'
|
|
131
|
+
data_file yes
|
|
132
|
+
histogram yes
|
|
133
|
+
|
|
134
|
+
def setup
|
|
135
|
+
@big = @json = File.read(File.join(File.dirname(__FILE__), 'ohai.json'))
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def benchmark_parser
|
|
139
|
+
@result = YAML.load(@json)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def generic_reset_method
|
|
143
|
+
@result == @big or raise "not equal"
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
class Parser2BenchmarkRails < Bullshit::RepeatCase
|
|
148
|
+
warmup yes
|
|
149
|
+
iterations 400
|
|
150
|
+
|
|
151
|
+
truncate_data do
|
|
152
|
+
alpha_level 0.05
|
|
153
|
+
window_size 50
|
|
154
|
+
slope_angle 0.1
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
autocorrelation do
|
|
158
|
+
alpha_level 0.05
|
|
159
|
+
max_lags 50
|
|
160
|
+
file yes
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
output_dir File.join(File.dirname(__FILE__), 'data')
|
|
164
|
+
output_filename benchmark_name + '.log'
|
|
165
|
+
data_file yes
|
|
166
|
+
histogram yes
|
|
167
|
+
|
|
168
|
+
def setup
|
|
169
|
+
a = [ nil, false, true, "fÖß\nÄr", [ "n€st€d", true ], { "fooß" => "bär", "qu\r\nux" => true } ]
|
|
170
|
+
@big = a * 100
|
|
171
|
+
@json = JSON.generate(@big)
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
def benchmark_parser
|
|
175
|
+
@result = ActiveSupport::JSON.decode(@json)
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
def generic_reset_method
|
|
179
|
+
@result == @big or raise "not equal"
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
class Parser2BenchmarkYajl < Bullshit::RepeatCase
|
|
184
|
+
warmup yes
|
|
185
|
+
iterations 2000
|
|
186
|
+
|
|
187
|
+
truncate_data do
|
|
188
|
+
alpha_level 0.05
|
|
189
|
+
window_size 50
|
|
190
|
+
slope_angle 0.1
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
autocorrelation do
|
|
194
|
+
alpha_level 0.05
|
|
195
|
+
max_lags 50
|
|
196
|
+
file yes
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
output_dir File.join(File.dirname(__FILE__), 'data')
|
|
200
|
+
output_filename benchmark_name + '.log'
|
|
201
|
+
data_file yes
|
|
202
|
+
histogram yes
|
|
203
|
+
|
|
204
|
+
def setup
|
|
205
|
+
@big = @json = File.read(File.join(File.dirname(__FILE__), 'ohai.json'))
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
def benchmark_parser
|
|
209
|
+
@result = Yajl::Parser.new.parse(@json)
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
def generic_reset_method
|
|
213
|
+
@result == @big or raise "not equal"
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
if $0 == __FILE__
|
|
218
|
+
Bullshit::Case.autorun false
|
|
219
|
+
|
|
220
|
+
case ARGV.first
|
|
221
|
+
when 'ext'
|
|
222
|
+
Parser2BenchmarkExt.run
|
|
223
|
+
when 'pure'
|
|
224
|
+
Parser2BenchmarkPure.run
|
|
225
|
+
when 'yaml'
|
|
226
|
+
Parser2BenchmarkYAML.run
|
|
227
|
+
when 'rails'
|
|
228
|
+
Parser2BenchmarkRails.run
|
|
229
|
+
when 'yajl'
|
|
230
|
+
Parser2BenchmarkYajl.run
|
|
231
|
+
else
|
|
232
|
+
system "#{RAKE_PATH} clean"
|
|
233
|
+
system "#{RUBY_PATH} #$0 yaml"
|
|
234
|
+
system "#{RUBY_PATH} #$0 rails"
|
|
235
|
+
system "#{RUBY_PATH} #$0 pure"
|
|
236
|
+
system "#{RAKE_PATH} compile_ext"
|
|
237
|
+
system "#{RUBY_PATH} #$0 ext"
|
|
238
|
+
system "#{RUBY_PATH} #$0 yajl"
|
|
239
|
+
Bullshit.compare do
|
|
240
|
+
output_filename File.join(File.dirname(__FILE__), 'data', 'Parser2BenchmarkComparison.log')
|
|
241
|
+
|
|
242
|
+
benchmark Parser2BenchmarkExt, :parser, :load => yes
|
|
243
|
+
benchmark Parser2BenchmarkExt, :parser_symbolic, :load => yes
|
|
244
|
+
benchmark Parser2BenchmarkPure, :parser, :load => yes
|
|
245
|
+
benchmark Parser2BenchmarkPure, :parser_symbolic, :load => yes
|
|
246
|
+
benchmark Parser2BenchmarkYAML, :parser, :load => yes
|
|
247
|
+
benchmark Parser2BenchmarkRails, :parser, :load => yes
|
|
248
|
+
benchmark Parser2BenchmarkYajl, :parser, :load => yes
|
|
249
|
+
end
|
|
250
|
+
end
|
|
251
|
+
end
|
|
@@ -16,6 +16,9 @@ when 'yaml'
|
|
|
16
16
|
when 'rails'
|
|
17
17
|
require 'active_support'
|
|
18
18
|
require 'json/pure'
|
|
19
|
+
when 'yajl'
|
|
20
|
+
require 'yajl'
|
|
21
|
+
require 'json/pure'
|
|
19
22
|
else
|
|
20
23
|
require 'json/pure'
|
|
21
24
|
end
|
|
@@ -38,9 +41,10 @@ class ParserBenchmarkExt < Bullshit::RepeatCase
|
|
|
38
41
|
include ParserBenchmarkCommon
|
|
39
42
|
|
|
40
43
|
warmup yes
|
|
41
|
-
iterations
|
|
44
|
+
iterations 2000
|
|
42
45
|
|
|
43
46
|
truncate_data do
|
|
47
|
+
enabled false
|
|
44
48
|
alpha_level 0.05
|
|
45
49
|
window_size 50
|
|
46
50
|
slope_angle 0.1
|
|
@@ -74,9 +78,10 @@ class ParserBenchmarkPure < Bullshit::RepeatCase
|
|
|
74
78
|
include ParserBenchmarkCommon
|
|
75
79
|
|
|
76
80
|
warmup yes
|
|
77
|
-
iterations
|
|
81
|
+
iterations 400
|
|
78
82
|
|
|
79
83
|
truncate_data do
|
|
84
|
+
enabled false
|
|
80
85
|
alpha_level 0.05
|
|
81
86
|
window_size 50
|
|
82
87
|
slope_angle 0.1
|
|
@@ -108,9 +113,10 @@ end
|
|
|
108
113
|
|
|
109
114
|
class ParserBenchmarkYAML < Bullshit::RepeatCase
|
|
110
115
|
warmup yes
|
|
111
|
-
iterations
|
|
116
|
+
iterations 400
|
|
112
117
|
|
|
113
118
|
truncate_data do
|
|
119
|
+
enabled false
|
|
114
120
|
alpha_level 0.05
|
|
115
121
|
window_size 50
|
|
116
122
|
slope_angle 0.1
|
|
@@ -144,9 +150,10 @@ end
|
|
|
144
150
|
|
|
145
151
|
class ParserBenchmarkRails < Bullshit::RepeatCase
|
|
146
152
|
warmup yes
|
|
147
|
-
iterations
|
|
153
|
+
iterations 400
|
|
148
154
|
|
|
149
155
|
truncate_data do
|
|
156
|
+
enabled false
|
|
150
157
|
alpha_level 0.05
|
|
151
158
|
window_size 50
|
|
152
159
|
slope_angle 0.1
|
|
@@ -178,6 +185,43 @@ class ParserBenchmarkRails < Bullshit::RepeatCase
|
|
|
178
185
|
end
|
|
179
186
|
end
|
|
180
187
|
|
|
188
|
+
class ParserBenchmarkYajl < Bullshit::RepeatCase
|
|
189
|
+
warmup yes
|
|
190
|
+
iterations 2000
|
|
191
|
+
|
|
192
|
+
truncate_data do
|
|
193
|
+
enabled false
|
|
194
|
+
alpha_level 0.05
|
|
195
|
+
window_size 50
|
|
196
|
+
slope_angle 0.1
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
autocorrelation do
|
|
200
|
+
alpha_level 0.05
|
|
201
|
+
max_lags 50
|
|
202
|
+
file yes
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
output_dir File.join(File.dirname(__FILE__), 'data')
|
|
206
|
+
output_filename benchmark_name + '.log'
|
|
207
|
+
data_file yes
|
|
208
|
+
histogram yes
|
|
209
|
+
|
|
210
|
+
def setup
|
|
211
|
+
a = [ nil, false, true, "fÖß\nÄr", [ "n€st€d", true ], { "fooß" => "bär", "qu\r\nux" => true } ]
|
|
212
|
+
@big = a * 100
|
|
213
|
+
@json = JSON.generate(@big)
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def benchmark_parser
|
|
217
|
+
@result = Yajl::Parser.new.parse(@json)
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
def generic_reset_method
|
|
221
|
+
@result == @big or raise "not equal"
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
|
|
181
225
|
if $0 == __FILE__
|
|
182
226
|
Bullshit::Case.autorun false
|
|
183
227
|
|
|
@@ -190,6 +234,8 @@ if $0 == __FILE__
|
|
|
190
234
|
ParserBenchmarkYAML.run
|
|
191
235
|
when 'rails'
|
|
192
236
|
ParserBenchmarkRails.run
|
|
237
|
+
when 'yajl'
|
|
238
|
+
ParserBenchmarkYajl.run
|
|
193
239
|
else
|
|
194
240
|
system "#{RAKE_PATH} clean"
|
|
195
241
|
system "#{RUBY_PATH} #$0 yaml"
|
|
@@ -197,6 +243,7 @@ if $0 == __FILE__
|
|
|
197
243
|
system "#{RUBY_PATH} #$0 pure"
|
|
198
244
|
system "#{RAKE_PATH} compile_ext"
|
|
199
245
|
system "#{RUBY_PATH} #$0 ext"
|
|
246
|
+
system "#{RUBY_PATH} #$0 yajl"
|
|
200
247
|
Bullshit.compare do
|
|
201
248
|
output_filename File.join(File.dirname(__FILE__), 'data', 'ParserBenchmarkComparison.log')
|
|
202
249
|
|
|
@@ -206,6 +253,7 @@ if $0 == __FILE__
|
|
|
206
253
|
benchmark ParserBenchmarkPure, :parser_symbolic, :load => yes
|
|
207
254
|
benchmark ParserBenchmarkYAML, :parser, :load => yes
|
|
208
255
|
benchmark ParserBenchmarkRails, :parser, :load => yes
|
|
256
|
+
benchmark ParserBenchmarkYajl, :parser, :load => yes
|
|
209
257
|
end
|
|
210
258
|
end
|
|
211
259
|
end
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
require 'mkmf'
|
|
2
2
|
require 'rbconfig'
|
|
3
3
|
|
|
4
|
+
unless $CFLAGS.gsub!(/ -O[\dsz]?/, ' -O3')
|
|
5
|
+
$CFLAGS << ' -O3'
|
|
6
|
+
end
|
|
4
7
|
if CONFIG['CC'] =~ /gcc/
|
|
5
|
-
$CFLAGS
|
|
6
|
-
|
|
8
|
+
$CFLAGS << ' -Wall'
|
|
9
|
+
#unless $CFLAGS.gsub!(/ -O[\dsz]?/, ' -O0 -ggdb')
|
|
10
|
+
# $CFLAGS << ' -O0 -ggdb'
|
|
11
|
+
#end
|
|
7
12
|
end
|
|
8
13
|
|
|
9
|
-
|
|
10
|
-
have_header("
|
|
11
|
-
|
|
14
|
+
if RUBY_VERSION < "1.9"
|
|
15
|
+
have_header("re.h")
|
|
16
|
+
else
|
|
17
|
+
have_header("ruby/re.h")
|
|
18
|
+
have_header("ruby/encoding.h")
|
|
19
|
+
end
|
|
20
|
+
create_makefile 'json/ext/generator'
|