Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #55372
| From | Alex <alex@rivadpm.com> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: Any ideas on faster TLS ? |
| Date | 2017-03-03 01:18 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <o9ag4s$fp2$1@dont-email.me> (permalink) |
| References | <o90deq$vvp$1@dont-email.me> <yuednW2Kf9GZZC7FnZ2dnUU7-KHNnZ2d@supernews.com> <o911tb$rfl$1@dont-email.me> <2017Mar1.133612@mips.complang.tuwien.ac.at> <o96h6k$fc6$1@dont-email.me> |
On 3/1/2017 13:11, Ron Aaron wrote:
>
>
> On 03/01/2017 14:36, Anton Ertl wrote:
>> Ron Aaron <rambamist@gmail.com> writes:
>
>>> Indeed, it's only one instruction. But it's a very expensive one.
>>
>> The best way to find out how expensive is to isolate and measure it,
>> so I did that:
>
> Yes; and when I did the rough equivalent, I found it was only a 5%
> difference so not really the problem.
>
The problem is surely the double indirection. For a "standard" variable,
I generate
variable x ok
: foo 10 x ! ; ok
ok
see foo
: foo ( ? -- ? )
\ foo is defined in (console)
\ call compiled
\ code=$41CA5E len=10 type=130
( $0 ) mov dword { $80537C } $A \ C7057C5380000A000000
( $A ) ret \ C3 ( end ) ok
whereas a TLS variable based on a register (eg EBX) (a "user" variable)
generates (the offset of Y up the TLS is $8C)
0 user y ok
: bar 10 y ! ; ok
see bar
: bar ( ? -- ? )
\ bar is defined in (console)
\ call compiled
\ code=$41CAC8 len=10 type=129
( $0 ) mov dword { $8C ebx } $A \ C7838C0000000A000000
( $A ) ret \ C3 ( end ) ok
If the TLS is addressed by FS: then it would be (and this code hand
cranked, because my Forth doesn't generate this);
code tls ok
mov ecx { fs: $e10 } \ first TLS slot in the TEB at $E10 ok
mov { ecx $8c } $a \ offset $8C for the TLS var ok[1]
next; ok
see tls
code tls ( ? -- ? )
\ tls is defined in (console)
\ call compiled
\ code=$41CA4F len=17 type=129
( $0 ) mov ecx dword { fs: $E10 } \ 648B0D100E0000
( $7 ) mov dword { $8C ecx } $A \ C7818C0000000A000000
( $11 ) ret \ C3 ( end ) ok
That's a lot more expensive; every reference is now twice through memory
and with an FS segreg overide on one of the.
--
Alex
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Any ideas on faster TLS ? Ron Aaron <rambamist@gmail.com> - 2017-02-27 07:30 +0200
Re: Any ideas on faster TLS ? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-02-27 04:01 -0600
Re: Any ideas on faster TLS ? Ron Aaron <rambamist@gmail.com> - 2017-02-27 13:19 +0200
Re: Any ideas on faster TLS ? Alex <alex@rivadpm.com> - 2017-02-27 12:56 +0000
Re: Any ideas on faster TLS ? Ron Aaron <rambamist@gmail.com> - 2017-02-27 15:10 +0200
Re: Any ideas on faster TLS ? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-02-27 17:08 +0100
Re: Any ideas on faster TLS ? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-02-27 08:06 -0600
Re: Any ideas on faster TLS ? Ron Aaron <rambamist@gmail.com> - 2017-02-27 16:10 +0200
Re: Any ideas on faster TLS ? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-02-27 09:31 -0600
Re: Any ideas on faster TLS ? Ron Aaron <rambamist@gmail.com> - 2017-02-28 07:05 +0200
Re: Any ideas on faster TLS ? Paul Rubin <no.email@nospam.invalid> - 2017-02-27 23:15 -0800
Re: Any ideas on faster TLS ? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-02-28 04:02 -0600
Re: Any ideas on faster TLS ? Bernd Paysan <bernd@net2o.de> - 2017-03-11 19:58 +0000
Re: Any ideas on faster TLS ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-03-01 12:36 +0000
Re: Any ideas on faster TLS ? Ron Aaron <rambamist@gmail.com> - 2017-03-01 15:11 +0200
Re: Any ideas on faster TLS ? Alex <alex@rivadpm.com> - 2017-03-03 01:18 +0000
Re: Any ideas on faster TLS ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-03-03 12:55 +0000
Re: Any ideas on faster TLS ? Alex <alex@rivadpm.com> - 2017-03-03 14:59 +0000
Re: Any ideas on faster TLS ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-03-03 16:15 +0000
Optimizing (was: Any ideas on faster TLS ?) Ron Aaron <rambamist@gmail.com> - 2017-03-17 13:14 +0200
Re: Any ideas on faster TLS ? rickman <gnuarm@gmail.com> - 2017-02-28 01:13 -0500
Re: Any ideas on faster TLS ? Paul Rubin <no.email@nospam.invalid> - 2017-02-27 22:48 -0800
Re: Any ideas on faster TLS ? rickman <gnuarm@gmail.com> - 2017-02-28 03:50 -0500
csiph-web