simon-git: spigot (master): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Fri Mar 23 19:23:56 GMT 2018
TL;DR:
b385996 Allow the Prepend class to use unvalidated gen_matrix.
Repository: https://git.tartarus.org/simon/spigot.git
On the web: https://git.tartarus.org/?p=simon/spigot.git
Branch updated: master
Committer: Simon Tatham <anakin at pobox.com>
Date: 2018-03-23 19:23:56
commit b3859967233ef43e8f5554f5ebfefdec904f13cb
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=b3859967233ef43e8f5554f5ebfefdec904f13cb;hp=d8e897b639ceb079453cdf059d1d4d2e641ab0d7
Author: Simon Tatham <anakin at pobox.com>
Date: Fri Mar 23 07:34:55 2018 +0000
Allow the Prepend class to use unvalidated gen_matrix.
Prepend performs a simple enough transformation on its child Source's
matrix stream that we need not separately (and slowly) validate both
the input and output versions of that stream. So I've special-cased it
as a 'friend' of class Source, allowing it to retrieve the child's
data stream without going through the base class's validating
wrappers.
(It was a surprise to me that I had to use 'friend', actually. A
class's implementation can access 'private' members in other instances
of the same class, not just in 'this', so I'd expected that I'd be
able to access 'protected' members in other instances of the base
class too. But apparently that only applies to other instances of the
_derived_ class: if D derives from B which has a protected member,
then D's methods are allowed to access that member in a D& but not in
a B&. Learn something every day.)
Anyway. Prepend is used all over the place within implementations of
more complicated functions: spigot_neg(), spigot_reciprocal(),
spigot_rational_mul() and spigot_mobius() are all based on it, and are
used in turn by many subexpressions inside implementations of
higher-level functions. So this tiny change all by itself recovers a
noticeable amount of the performance drop from introducing the
complicated refinement check: by the crude benchmark of running 'time
test.sh', the refinement check slowed down spigot by a factor of 1.28
before this change to Prepend, and now slows it down by a mere factor
of 1.19.
spigot.h | 2 ++
unary.cpp | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
More information about the tartarus-commits
mailing list