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


Groups > comp.lang.forth > #13695

Re: Permutation Tensor

From mhx@iae.nl (Marcel Hendrix)
Subject Re: Permutation Tensor
Newsgroups comp.lang.forth
Message-ID <17969495968435@frunobulax.edu> (permalink)
Date 2012-07-08 09:07 +0200
References <7xpq87b0i2.fsf@ruckus.brouhaha.com>
Organization Wanadoo

Show all headers | View raw


Paul Rubin <no.email@nospam.invalid> writes Re: Permutation Tensor

> mhx@iae.nl (Marcel Hendrix) writes:
>> all non-local implementations have approximately the same speed, and the
>> locals add a sizable overhead (because iForth doesn't inline words that 
>> use locals.)

> Thanks, how about this?

>  : eps3 ( i j k -- e ) 2dup - >r -rot 2dup - >r drop - 2r> * * 2/ ; 

FORTH> 1000000000 toptest
\ lcsymbol  : 2.409 seconds elapsed.
\ lcsymbol2 : 2.136 seconds elapsed.
\ lcsymbol3 : 2.016 seconds elapsed.
\ lcsymbol4 : 1.711 seconds elapsed.
\ eps       : 2.221 seconds elapsed.
\ eps2      : 7.174 seconds elapsed.
\ eps3      : 2.221 seconds elapsed.
\ weps      : 2.225 seconds elapsed.
\ weps2     : 7.008 seconds elapsed. ok

As you can see, eps and eps3 differ insignificantly.

Thanks to your questions, I looked into it a little further.
Instead of doing only a b c eps3, I tried  a b c eps3
1 b c eps3a, 1 2 c eps3ab, and 1 2 3 eps3abc (i.e. some
arguments are constants instead of variables). 

The 1 2 3 eps3abc will calculate lcsymbol at compile time, 
therefore the loop overhead time comes out at 0.5 seconds.

The other three implementations cause the word to fetch 
up to three cells from memory:

\ eps3      : 2.221 seconds elapsed. ( fetch 3 cells )
\ eps3a     : 1.579 seconds elapsed. ( fetch 2 cells )
\ eps3ab    : 1.399 seconds elapsed. ( fetch 1 cell )
\ eps3abc   : 0.513 seconds elapsed. ( compute at compile-time)

The run-time difference for these implementations
appears to be caused by their number of memory accesses.

-marcel


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


Thread

Permutation Tensor Arnold Doray <invalid@invalid.com> - 2012-07-05 07:13 +0000
  Re: Permutation Tensor "A. K." <akk@nospam.org> - 2012-07-05 09:25 +0200
    Re: Permutation Tensor Arnold Doray <invalid@invalid.com> - 2012-07-05 08:42 +0000
      Re: Permutation Tensor "A. K." <akk@nospam.org> - 2012-07-05 11:25 +0200
        Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-06 18:49 -0700
          Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-07 08:32 +0200
            Re: Permutation Tensor "A. K." <akk@nospam.org> - 2012-07-07 09:49 +0200
            Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-07 05:35 -0700
               Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-07 15:45 +0200
                Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-07 07:32 -0700
                Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-07 17:53 +0200
                Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-07 09:10 -0700
                Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-07 18:41 +0200
                Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-07 12:24 -0700
                Re: Permutation Tensor Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2012-07-08 07:48 +0100
                Re: Permutation Tensor Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2012-07-08 08:09 +0100
                Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-08 09:23 +0200
                Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-08 05:55 -0700
                Re: Permutation Tensor Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2012-07-08 20:14 +0100
                Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-08 13:49 -0700
                Re: Permutation Tensor Paul Rubin <no.email@nospam.invalid> - 2012-07-07 13:03 -0700
                Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-07 23:54 +0200
                Re: Permutation Tensor Paul Rubin <no.email@nospam.invalid> - 2012-07-07 16:43 -0700
                Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-08 09:07 +0200
                Re: Permutation Tensor Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-08 13:03 +0000
                Re: Permutation Tensor anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-09 14:50 +0000
                Re: Permutation Tensor m.a.m.hendrix@tue.nl - 2012-07-10 00:28 -0700
                Re: Permutation Tensor anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-10 10:11 +0000
                Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-10 21:37 +0200
                Re: Permutation Tensor anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-11 13:50 +0000
                Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-10 05:10 -0700
        Re: Permutation Tensor Paul Rubin <no.email@nospam.invalid> - 2012-07-06 20:46 -0700
          Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-07 05:36 -0700
  Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-06 18:18 -0700
    Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-06 18:33 -0700
    Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-07 07:28 -0700
      Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-07 08:02 -0700
  Re: Permutation Tensor Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-07 19:58 +0000
    Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-08 05:45 -0700
      Re: Permutation Tensor Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-08 20:05 +0000
  Re: Permutation Tensor awegel@arcor.de (Alex Wegel) - 2012-07-08 14:24 +0200
    Re: Permutation Tensor awegel@arcor.de (Alex Wegel) - 2012-07-11 07:09 +0200
      Re: Permutation Tensor awegel@arcor.de (Alex Wegel) - 2012-07-11 18:42 +0200
        Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-11 20:18 +0200
          Re: Permutation Tensor awegel@arcor.de (Alex Wegel) - 2012-07-12 12:43 +0200
            Re: Permutation Tensor Arnold Doray <invalid@invalid.com> - 2012-07-25 14:07 +0000
              Re: Permutation Tensor awegel@arcor.de (Alex Wegel) - 2012-07-27 13:42 +0200
                Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-27 15:39 +0200
                Re: Permutation Tensor Arnold Doray <invalid@invalid.com> - 2012-07-30 04:52 +0000
  Re: Permutation Tensor awegel@arcor.de (Alex Wegel) - 2012-07-08 23:44 +0200
    Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-10 17:06 -0700
      Re: Permutation Tensor awegel@arcor.de (Alex Wegel) - 2012-07-11 07:09 +0200
  Re: Permutation Tensor Arnold Doray <invalid@invalid.com> - 2012-07-25 14:08 +0000

csiph-web