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


Groups > comp.lang.forth > #52790

Re: Data Stack of Just Pointers?

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.forth
Subject Re: Data Stack of Just Pointers?
Date Mon, 21 Nov 2016 10:45:46 -0800
Organization A noiseless patient Spider
Lines 30
Message-ID <87d1hobrj9.fsf@nightsong.com> (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> <o0uham$8bj$1@cherry.spenarnc.xs4all.nl> <o0uhjt$qgg$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain
Injection-Info mx02.eternal-september.org; posting-host="8e075ebfe650478e78ea2fd59b90ed88"; logging-data="4930"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/JnKqeP2WS898opM+cP3ke"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Cancel-Lock sha1:/1ZCk2zsaGQOWjwrDjC3tHB80iI= sha1:gE6gb8opwqvxkwlFZD8r4FKL9Ac=
Xref csiph.com comp.lang.forth:52790

Show key headers only | View raw


Ron Aaron <rambamist@gmail.com> writes:
> The 2.36 was g++ -O2, that's the fastest it did.  This was relying on
> the std library, so possibly using boost etc. might be faster.

What version of gcc was that?  I got > 30+% speedup going from 4.8.3 to
6.1 (haven't tried 6.2).  I also got about 20% by changing

        string key = record.substr(0, pos2);
        string val = record.substr(pos2+1, record.length());
        retval[key] = val;

to

        retval.emplace(record.substr(0, pos2),                        
                       record.substr(pos2+1, record.length()));   

in the inner loop, which gets rid of some unnecessary string copying.
And I got a few more percent from changing std::map (which uses a
balanced tree of some sort) to std::unordered_map, which uses hashing.

gcc 6.1's C++ library doesn't seem to support C++17 string views (I
think 6.2 supports them) but using a string view for "record" should
eliminate some more small object allocation and copying.  (A string view
is a pointer to a segment of another string).

That's still pretty impressive about 8th!  I wonder if your memory
allocator is more efficient than C++'s (I remember your saying you use
mark/sweep gc).  I wonder how a stop-and-copy gc would do against either
of them.  The Boost intrusive containers (you mentioned Boost) might be
another possibility.

Back to comp.lang.forth | Previous | Next — Previous in thread | Next 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