Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #52812

Re: Data Stack of Just Pointers?

From "Robert L." <No_spamming@noWhere_7073.org>
Newsgroups comp.lang.forth
Subject Re: Data Stack of Just Pointers?
Date 2016-11-22 11:37 +0000
Organization Aioe.org NNTP Server
Message-ID <o11am2$1ldg$1@gioia.aioe.org> (permalink)
References <d8771e5d-b872-4376-a206-ceda23a73c43@googlegroups.com> <2016Nov20.142921@mips.complang.tuwien.ac.at> <o0sl5s$k32$1@dont-email.me> <o0u6jf$ppr$1@dont-email.me>

Show all headers | View raw


On 11/20/2016, Ron Aaron wrote:

> Though as a curiosity, I created a C++ version of my "FIX parsing"
> benchmark using the std C++ libraries.
> 
> To my surprise, 8th outperformed unoptimized C++ by quite a lot, and was
> pretty competitive even with "-O2" optimized C++ (for reference, the 8th
> version took 2.67 sec while the optimized C++ took 2.36, and unoptimized
> C++ took 4.14).

OCaml:


(* Compile with
ocamlopt parse_fix.ml
*)

let fixrec = "8=FIX.4.2\x019=153\x0135=D\x0149=BLP\x0156=SCHB\x0134=1\x01" ^
 "50=30737\x0197=Y\x0152=20000809-20:20:50\x0111=90001008\x011=10030003\x01" ^
 "21=2\x0155=TESTA\x0154=1\x0138=4000\x0140=2\x0159=0\x0144=30\x0147=I\x01" ^
 "60=20000809-18:20:32\x0110=061\x01"

open String

let parse_fix string =
  let result = Hashtbl.create 32 in
    let rec  loop i =
      try
        let middle = index_from string i '=' in
        let right = index_from string (middle+1) '\x01' in
          Hashtbl.add result
            (sub string i (middle - i))
            (sub string (middle+1) (right - middle - 1)) ;
          loop (right + 1)
      with Not_found | Invalid_argument _ -> ()
    in loop 0 ;
    result ;;

let start = Sys.time () in
  for _ = 1 to 400_000 do  ignore (parse_fix fixrec)  done ;
  Printf.printf "%.2f sec.\n" (Sys.time () -. start)




On an old winXP laptop the output is

1.97 sec.


-- 
Goyim were born only to serve us....  They will work, they will plow, they will
reap. We will sit like an effendi and eat. --- Rabbi Ovadia Yosef
web.archive.org/web/20101020044210/http://www.jpost.com/JewishWorld/JewishNews/Article.aspx?id=191782
archive.org/download/DavidDuke_videos/TopRabbiExposesJewishRacism-cybsdwjezqi.ogv

Back to comp.lang.forth | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Data Stack of Just Pointers? trans <transfire@gmail.com> - 2016-11-18 10:10 -0800
  Re: Data Stack of Just Pointers? Paul Rubin <no.email@nospam.invalid> - 2016-11-18 10:45 -0800
  Re: Data Stack of Just Pointers? Rod Pemberton <NeedNotReplyHere@xrsevnneqk.cem> - 2016-11-18 20:39 -0500
    Re: Data Stack of Just Pointers? minforth@arcor.de - 2016-11-19 03:14 -0800
      Re: Data Stack of Just Pointers? hughaguilar96@gmail.com - 2016-11-19 18:26 -0800
        Re: Data Stack of Just Pointers? trans <transfire@gmail.com> - 2016-11-19 18:50 -0800
          Re: Data Stack of Just Pointers? hughaguilar96@gmail.com - 2016-11-19 19:54 -0800
      Re: Data Stack of Just Pointers? trans <transfire@gmail.com> - 2016-11-19 18:52 -0800
        Re: Data Stack of Just Pointers? minforth@arcor.de - 2016-11-21 11:46 -0800
    Re: Data Stack of Just Pointers? trans <transfire@gmail.com> - 2016-11-19 13:57 -0800
  Re: Data Stack of Just Pointers? Jan Coombs <jenfhaomndgfwutc@murmic.plus.com> - 2016-11-19 11:27 +0000
  Re: Data Stack of Just Pointers? Ron Aaron <rambamist@gmail.com> - 2016-11-19 18:05 +0200
  Re: Data Stack of Just Pointers? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-11-20 13:29 +0000
    Re: Data Stack of Just Pointers? Spiros Bousbouras <spibou@gmail.com> - 2016-11-20 15:43 +0000
    Re: Data Stack of Just Pointers? Ron Aaron <rambamist@gmail.com> - 2016-11-20 19:06 +0200
      Re: Data Stack of Just Pointers? Ron Aaron <rambamist@gmail.com> - 2016-11-21 09:09 +0200
        Re: Data Stack of Just Pointers? Paul Rubin <no.email@nospam.invalid> - 2016-11-20 23:17 -0800
          Re: Data Stack of Just Pointers? Ron Aaron <rambamist@gmail.com> - 2016-11-21 09:22 +0200
        Re: Data Stack of Just Pointers? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-11-21 11:12 +0100
          Re: Data Stack of Just Pointers? Ron Aaron <rambamist@gmail.com> - 2016-11-21 12:17 +0200
            Re: Data Stack of Just Pointers? Paul Rubin <no.email@nospam.invalid> - 2016-11-21 10:45 -0800
              Re: Data Stack of Just Pointers? Ron Aaron <rambamist@gmail.com> - 2016-11-21 21:22 +0200
                Re: Data Stack of Just Pointers? Paul Rubin <no.email@nospam.invalid> - 2016-11-21 17:28 -0800
                Re: Data Stack of Just Pointers? Ron Aaron <rambamist@gmail.com> - 2016-11-22 06:49 +0200
                Re: Data Stack of Just Pointers? Paul Rubin <no.email@nospam.invalid> - 2016-11-21 21:13 -0800
                Re: Data Stack of Just Pointers? franck.bensusan@gmail.com - 2016-12-21 13:48 -0800
        Re: Data Stack of Just Pointers? Cecil Bayona <cbayona@cbayona.com> - 2016-11-21 13:22 -0600
          Re: Data Stack of Just Pointers? "Robert L." <No_spamming@noWhere_7073.org> - 2016-11-22 01:53 +0000
            Re: Data Stack of Just Pointers? Cecil Bayona <cbayona@cbayona.com> - 2016-11-21 21:16 -0600
          Re: Data Stack of Just Pointers? Ron Aaron <rambamist@gmail.com> - 2016-11-22 07:01 +0200
        Re: Data Stack of Just Pointers? "Robert L." <No_spamming@noWhere_7073.org> - 2016-11-22 11:37 +0000

csiph-web